 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
ThE eNeTin
Joined: 30 May 2006 Posts: 4
|
Posted: Wed Jun 07, 2006 5:38 am Post subject: Multiplayer.. |
|
|
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 |
|
 |
be2003
Joined: 20 Apr 2006 Posts: 144
|
Posted: Thu Jun 08, 2006 10:25 am Post subject: |
|
|
| 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 |
|
 |
daurnimator

Joined: 11 Dec 2005 Posts: 38 Location: melbourne, australia
|
Posted: Thu Jun 08, 2006 10:26 am Post subject: Re: Multiplayer.. |
|
|
| 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 |
|
 |
be2003
Joined: 20 Apr 2006 Posts: 144
|
Posted: Fri Jun 09, 2006 3:11 am Post subject: |
|
|
and dont forget to define all of your colors. white = Color.new(255,255,255) _________________ - be2003
blog |
|
| Back to top |
|
 |
ThE eNeTin
Joined: 30 May 2006 Posts: 4
|
Posted: Fri Jun 09, 2006 4:52 am Post subject: |
|
|
| thank to all!! :D |
|
| Back to top |
|
 |
|
|
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
|