Help with a turn based game
Hey everybody. Im making a Turn-Based game. Ive pretty much finished the game lookwise but I need to insert all the cammands. I ran into a problem with the turn based stuff. The problem being i dont know what to do. :crazy: By that I mean, how would I be able to make it where I can only go so far and the same for the computer/other person. Also has would I make it so the computer can go around walls and things instead of threw them? Also can someone tell me how I can make it so when its Player A's turn, Player B cant move if you click and vise versa. Thanks in advance!
Re: Help with a turn based game
"By that I mean, how would I be able to make it where I can only go so far and the same for the computer/other person."
Assign a counter to count the number of moves for player 1. Use a second counter to do the same for player 2.
"Also has would I make it so the computer can go around walls and things instead of threw them?"
Create collision sensors - invisible sprites that border your main object (top, bottom, left and right sensors). Test to see if a sensor is colliding with a wall then do the appropriate action, e.g. if top sensor hits a horizontal wall, then restrict movement to only left, right or down.
" Also can someone tell me how I can make it so when its Player A's turn, Player B cant move if you click and vise versa."
Set all the actions for each player's turn as a group of events. When it's player 1's turn, activate the group 'Player 1', deactivate group 'Player 2'. Do the opposite when it's player 2's turn.
Re: Help with a turn based game
Thanks for the info, it really helped me out. But about the first one, how would I make it stops at each panel when you use the arrow keys and tap a direction, Ex: Player A is on a panel and theres 5 panels to the right of him. How would I make it so he moves onto the 1st panel stops then if you decide to push it again he goes to the second panel stops and so on. Im trying to do it by making the hero a path movement and making a node at each box but I dont know how to make him reverse by doing that is there a easier way? Thanks in advance
Re: Help with a turn based game
Oh, I knew i was forgetting something, i meant to say this before, how do you make the computer "smart" as in it will try to go to the enemy and attack it instead of going where you make it go? Thanks in advance.
Re: Help with a turn based game
"how would I make it stops at each panel when you use the arrow keys and tap a direction, Ex: Player A is on a panel and theres 5 panels to the right of him. How would I make it so he moves onto the 1st panel stops then if you decide to push it again he goes to the second panel stops and so on."
Use a counter or a flag.
Set the initial value to 1. When a direction key is pressed and the value of the flag = 1, set value to zero and move once. When all direction keys are not pressed, set the value back to 1.
"how do you make the computer "smart" as in it will try to go to the enemy and attack it instead of going where you make it go?"
Pretty much same idea as described in this thread, only make it turn-based as discussed earlier:
http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=215256#Post2152 56
On a very basic level, Turn-Based gameplay is just Real-Time slowed down . . .
Re: Help with a turn based game
1. Use a grid movement. There are some examples of that kind of movement on my website, using fast loop. Look at the Site Map.
Marv
Re: Help with a turn based game
Not to be rude or anything but I think you're asking us to explain how to make all of the gameplay... which isn't really what you should be doing. You should be asking more specific things and figuring out the general stuff on your own.
So far you've basically asked:
- how to set up turns
- how to move the player
- how to move the enemy
- how to create pathfinding
- how to make enemy AI
I mean, short of asking us how to attack and deal damage and determine a winner... you've basically asked how to make a turnbased game.
I know you're learning or whatever but you really should at least attempt some of this stuff on your own. If you don't know how to use MMF, you need to learn that first. The rest of this stuff is just experimentation with the knowledge you have. Like how to declare a turn... well you'd want to most likely use a flag or something to determine whose turn it is. This is stuff you should know if you actually spent some time learning the program.
I think people here are being a bit too nice. But maybe I'm just in a bad mood? :P
Re: Help with a turn based game
well about what the person said above i was kind of thinking that as well, however I have given it a few days of thougt before coming here. I was about to quit this project before I remembered about this place. I did ask for a lot of help but I just couldnt grasp it myself -.- and after searching around a while I found out a lot of people are also having trouble with the AI (giving the cpu a brain) which I still need trouble with, besides the things ive mentioned I have the game finished already which i posted originally. So, maybe I am asking to much, idk Ive never used this before. But the forum is for help with what you dont understand right?
Re: Help with a turn based game
Can someone explain how to make the computer think for itself? Ex: go up to the enemy and attack it instead of following a path you make. I dont think I can figure it out. Thanks in advance
Re: Help with a turn based game
thebeast250...how much experience with MMF2 have you had before?
Try making a realtime game, because as someone said above, turn based is just real time at a very, very, very, slow rate.
Try making an enemy that looks for the player and travels around the map hunting the player.
Try usign a giant invisible circle around the player (and when the enemy is over the circle, it "looks in the direction" of the player, using a bouncing ball movement)
Get the enemy to be "stopped" and then "go" when it touches the circle.
Use flag on/flag off to accomplish this:
Quote:
+ Enemy overlaps player LineOfSight [the circle]
== Enemy flag 1 on
+ Flag 1 on
== Enemy movement "on"
== Enemy look in direction of Player
Use a "negation" to work out the opposite.
You need to experiment yourself -- MMF2 has many hundreds of ways of accomplishing the same thing.
My above example will teach you about flags and about making an "intelligent" enemy -- one that will only chase the player when it can "see" the player, as against if you used JUST a bouncing ball/LookInDirectionOf (which would eternally chase the player)
Now, once you have succeeded in creating a good Real Time enemy, slow things down to a stop.
Use a single counter to work out whose turn it is:
Quote:
+ If Counter = 0
== Activate Group "Player Turn"
+If counter = 1
== Activate Group "Enemy Turn"
+ Player clicks "End Turn" button
== Set counter to 1
Stuff like that. Get that working, first, then take another step.
Don't do this all at once.
Pathfinding is one of the hardest things to program, so take it very slowly.
Use the "sensors" around the player to check if it is touching anything. Eg:
Quote:
+Always
== Set SensorLeft to -32,0 from Player
[For a left facing , 32x32 active object]
+Player presses Left key
+[NEGATE]SensorLeft overlapping ActiveWall
+Player AltValue "Moves Left" >= 1
== AltValue "MovesLeft" sub 1
== Set player position X to Player Position X-32
Those conditions above will make sure the player never goes outside of the Walled area and will only move if it has enough moves left.
Put that together, now, with four sensors, a counter and an end-turn button.
You have a player that can only move if it has enough move points left and has been restricted to the game screen (if you have the relevant active objects positioned about the place)
The wall condition also allows walls to be placed inside the map, making a maze that the player has to walk around.
So go away and try that, and then come back and with a little more knowledge, ask again.
I'm not being mean, just giving you a reality check like Konidias did. You need to get some practice under your belt and then attempt bigger things.
Start with Real time, then move onto turn based. Learn about flags, group activation, counters, checking alterable values and all that sort of stuff, and keep on trying.