hello, i have a 2 player game similar to snake and ladders. But my problem is i have a 2 player game, a girl and a boy. i wanted to trap the code like theres only 2 players .The flow goes this way, when the user clicks either of the two players given, for example player 1 choses the girl player and then player 2 again choses the same girl player, and then the play button appears. My problem is how to trap each 2 actors(girl and boy actors) to limit only two selection before the play button appears. My current code was if both players are empty(coz you have to input a name for each player) the play button wont appear unless both players 1 and 2 are ready. I really need help on this. heres the code for the "Choose player card"
global pTwoname,pOnename,soundPlay,tPath,tChannelName,tType,pPath,pChannelName,pType,clickButton
global sPath, sChannelName, sType,disablePlayer,charSelection
on openCard
playAppear
stopButton
play stop pPath
end openCard
on preOpenCard
enable button "Actor 1"
enable button "Actor 2"
put empty into fld "cNameone" --fld "cNameone"
put empty into fld "cNametwo"
show img "choose avatar"
show btn "Actor 1"
show btn "Actor 2"
hide group "p1"
playAppear
showPlayerReady
if pOnename is not empty then
show img "player1"
disable btn "Actor 1"
end if
if pTwoname is not empty then
show img "player2"
disable btn "Actor 2"
end if
end preOpenCard
on playAppear
if pOnename is not empty and pTwoname is not empty then
show btn "ply"
else
hide btn "ply"
end if
end playAppear
on stopPreviousSound
if (mobileSoundOnChannel("intro") is empty) or (mobileSoundOnChannel("intro") is "could not find channel") then
put (specialFolderPath("engine") & "/intro.aif") into tPath
put "intro" into tChannelName
put "now" into tType
mobilePlaySoundOnChannel tPath, tChannelName, tType
else
mobileStopPlayingOnChannel "intro"
end if
end stopPreviousSound
on stopButton
if (mobileSoundOnChannel("play") is empty) or (mobileSoundOnChannel("play") is "could not find channel") then
put (specialFolderPath("engine") & "/play.aif") into pPath
put "play" into pChannelName
put "now" into pType
mobilePlaySoundOnChannel pPath, pChannelName, pType
else
mobileStopPlayingOnChannel "play"
end if
end stopButton
Limit 2 players in a game
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- VIP Livecode Opensource Backer
- Posts: 3901
- Joined: Sat Mar 24, 2007 2:54 am
- Location: Palo Alto
Re: Limit 2 players in a game
Hi kesh17aki,
It's not clear to me what your question is.
Did you mean only 1 girl and 1 boy can be selected?
Simon
It's not clear to me what your question is.
Did you mean only 1 girl and 1 boy can be selected?
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!