Author |
Message |
Krocker
|
Posted: Fri Jan 21, 2011 4:09 pm Post subject: 2 player game. |
|
|
I was wondering, how can i create a game that asks the users if they want 2 player or 1 player mode. and then have thea game set for one player and another one for 2 play. is that possible? and how can i do it if so? |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Tony
|
Posted: Fri Jan 21, 2011 4:15 pm Post subject: RE:2 player game. |
|
|
With an if statement. Perhaps also some variable to remember the answer. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
Krocker
|
Posted: Fri Jan 21, 2011 4:16 pm Post subject: RE:2 player game. |
|
|
i relized that im gonna have to uuse if statements, but how? |
|
|
|
|
|
Tony
|
|
|
|
|
Krocker
|
Posted: Fri Jan 21, 2011 4:20 pm Post subject: RE:2 player game. |
|
|
all i want is an example or explanation on how i can make a 2 player game. I am not sure how to start it off. |
|
|
|
|
|
Tony
|
Posted: Fri Jan 21, 2011 4:22 pm Post subject: RE:2 player game. |
|
|
Start with a mode that you think would be easier to implement. You can worry about the other mode later. |
Tony's programming blog. DWITE - a programming contest. |
|
|
|
|
Krocker
|
Posted: Fri Jan 21, 2011 4:50 pm Post subject: RE:2 player game. |
|
|
thats done. i got the 1 player mode finished. i just need the 2 player mode now |
|
|
|
|
|
Insectoid
|
Posted: Fri Jan 21, 2011 7:16 pm Post subject: RE:2 player game. |
|
|
You're going to want an AI function, and a function to get and process input from the player. When you decide to move player 2, either run the AI function or the input function, depending on weather it's 2player or 1player. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Krocker
|
Posted: Sat Jan 22, 2011 8:43 am Post subject: RE:2 player game. |
|
|
im not sure what u meant by AI functions. but i was going to have that is 2player was selected it would exit loop and go into anothe loop with thw 2 play commands. but if its 1 player, its stays in that loop and starts the game for 1 player. that was my idea. |
|
|
|
|
|
TokenHerbz
|
Posted: Sat Jan 22, 2011 9:59 am Post subject: RE:2 player game. |
|
|
why not just keep them inside your ONE game loop. And if player 2 is active then player 2 controls it otherwise the PC (Your AI {artificial intelegence}) takes over.
a simple example of AI is this. consider your making a ping pong game, you control one paddle, and the "AI" does the right. if ball is above his paddle he moves up, if its lower then he moves down. (as simple as it gets)...
So if you have a player 2 active, instead of the PC doing those AI movements, they will do player 2's instead. |
|
|
|
|
|
Krocker
|
Posted: Sat Jan 22, 2011 10:21 am Post subject: RE:2 player game. |
|
|
interseting, i was tinking more of te lines of a memory game using letters, where there is a sequance of letters and the suer needs to input the letters at the corresponding time. So there is no need for an AI. Im not that good at turing to make a ping poong game =) |
|
|
|
|
|
TokenHerbz
|
Posted: Sat Jan 22, 2011 10:40 am Post subject: RE:2 player game. |
|
|
its a very basic beginner game to create. I would suggest trying it! perhaps after your current project. |
|
|
|
|
|
Krocker
|
Posted: Sat Jan 22, 2011 10:44 am Post subject: RE:2 player game. |
|
|
i will thx. |
|
|
|
|
|
|