forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Multiplayer..

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development
View previous topic :: View next topic  
Author Message
ThE eNeTin



Joined: 30 May 2006
Posts: 4

PostPosted: Wed Jun 07, 2006 5:38 am    Post subject: Multiplayer.. Reply with quote

How can i implement the multiplayer in my game through the irda?

I've written this code, but i haven't tried it.
it's only a test for see if i succeed to establish a logon between two psp, even if i don't know well like realizing it.

Quote:
System.irdaInit()

ownCrossPressed = "false"
otherCrossPressed = "false"
sprite = Image.createEmpty(64, 64)


while true do
screen:clear()
screen:print(0, 0, otherCrossPressed, white)
screen:print(0, 10, ownCrossPressed, white)

pad = Controls.read()
if pad:cross() then
ownCrossPressed = "cros"
System.irdaWrite("X")
else
System.irdaWrite("false")
end

if pad:start() then break
end

opad = System.irdaRead()
if opad:cross() then
otherCrossPressed = "X"
else
otherCrossPressed = "false"
end

screen.waitVblankStart()
screen.flip()
end


There would be pleasing if you helped me.

excuse me for my bad english.

Thanks.
Back to top
View user's profile Send private message
be2003



Joined: 20 Apr 2006
Posts: 144

PostPosted: Thu Jun 08, 2006 10:25 am    Post subject: Reply with quote

Code:

System.irdaInit()

black = Color.new(0,0,0)
white = Color.new(255,255,255)

ownCrossPressed = "false"
otherCrossPressed = "false"
sprite = Image.createEmpty(64, 64) -- You didn't even use this in your code

while not Controls.read():start() do

pad = Controls.read()
if pad:cross() then
ownCrossPressed = "cross"
System.irdaWrite("X")
else
System.irdaWrite("false")
end

opad = System.irdaRead()
if string.len(opad) > 0 then
otherCrossPressed = opad
else
otherCrossPressed = "false"
end

screen:clear(black)
screen:print(0, 0, otherCrossPressed, white)
screen:print(0, 10, ownCrossPressed, white)
screen.waitVblankStart()
screen.flip()
end

_________________
- be2003
blog
Back to top
View user's profile Send private message
daurnimator



Joined: 11 Dec 2005
Posts: 38
Location: melbourne, australia

PostPosted: Thu Jun 08, 2006 10:26 am    Post subject: Re: Multiplayer.. Reply with quote

ThE eNeTin wrote:
How can i implement the multiplayer in my game through the irda?

I've written this code, but i haven't tried it.
it's only a test for see if i succeed to establish a logon between two psp, even if i don't know well like realizing it.

Quote:
System.irdaInit()

ownCrossPressed = "false"
otherCrossPressed = "false"
sprite = Image.createEmpty(64, 64)


while true do
screen:clear()
screen:print(0, 0, otherCrossPressed, white)
screen:print(0, 10, ownCrossPressed, white)

pad = Controls.read()
if pad:cross() then
ownCrossPressed = "cros"
System.irdaWrite("X")
else
System.irdaWrite("false")
end

if pad:start() then break
end

opad = System.irdaRead()
if opad:cross() then
otherCrossPressed = "X"
else
otherCrossPressed = "false"
end

screen.waitVblankStart()
screen.flip()
end


There would be pleasing if you helped me.

excuse me for my bad english.

Thanks.


problem is that you're trying to read a ctrl set from the opponent - when they're only sending X or false..

try something like:
Quote:
System.irdaInit()

ownCrossPressed = "false"
otherCrossPressed = "false"

while true do
screen:clear()
screen:print(0, 0, "Other Cross Pressed: "..otherCrossPressed, white)
screen:print(0, 10, "Own Cross Pressed: "..ownCrossPressed, white)

pad = Controls.read()
if pad:cross() then
ownCrossPressed = "X"
System.irdaWrite("X")
else
ownCrossPressed = "false"
System.irdaWrite("false")
end

if pad:start() then break end

otherCrossPressed = System.irdaRead()

screen.waitVblankStart()
screen.flip()
end
Back to top
View user's profile Send private message MSN Messenger
be2003



Joined: 20 Apr 2006
Posts: 144

PostPosted: Fri Jun 09, 2006 3:11 am    Post subject: Reply with quote

and dont forget to define all of your colors. white = Color.new(255,255,255)
_________________
- be2003
blog
Back to top
View user's profile Send private message
ThE eNeTin



Joined: 30 May 2006
Posts: 4

PostPosted: Fri Jun 09, 2006 4:52 am    Post subject: Reply with quote

thank to all!! :D
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Lua Player Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group