Playin with my Man!!
I got my Iso-metric engine for my game goin and now i''m at the stage of puttin my man on the screen and movin that bad-boy about!!
He is a commando Called Joe. Joe will move to where ever the player clicks the mouse cursor on the Map! The only other option is if the mouse cursor is over an enemy Joe will then shoot the enemy when the mouse button is clicked!! But the enemies have not been implemented yet so it''s not to important for now!
Each object on the map takes up the whole of each tile! so i''ll be using coarse object placment!!
Does anybody have an recommendations as to the best way to do this!! I.e. simplest as i''m new to this lark of game programming!!
Thanks Brian
No i''m just tryin to get the Man on to the screen and to move from tile to tile using the mouse... just any recommendations before i go down the wrong road about doin it!! Just checkin ouot various examples that others have used to to the same thing to see if i can fing something that suit!!
A bit lost as to what values i need to store for my man!! And what is the best way/method to store them!
Thanks Brian
A bit lost as to what values i need to store for my man!! And what is the best way/method to store them!
Thanks Brian
Hi!
Store Joe's x/y coordinates, a flag if he's moving or not, and another pair of x/y for his destination!!
If you click on the map, update Joe's destination with the location of the click! Also, set his moving flag to TRUE if the destination is not his current location!
Continuously check to see if Joe's move flag is set, and if so make him head towards his destination! If he reaches it, set his move flag to FALSE!
More exact than that is going to require more information from you!
Question! Why do you use so many exclamation marks! They are only properly used when expressing excitement or great emotion!
Just wondering!!!!!
Chris
Florida, USA
RTS Engine in Development
http://www.knology.net/~heaven
Jesus is LORD!
Edited by - Heaven on February 19, 2002 6:05:41 PM
Store Joe's x/y coordinates, a flag if he's moving or not, and another pair of x/y for his destination!!
If you click on the map, update Joe's destination with the location of the click! Also, set his moving flag to TRUE if the destination is not his current location!
Continuously check to see if Joe's move flag is set, and if so make him head towards his destination! If he reaches it, set his move flag to FALSE!
More exact than that is going to require more information from you!
Question! Why do you use so many exclamation marks! They are only properly used when expressing excitement or great emotion!
Just wondering!!!!!
Chris
Florida, USA
RTS Engine in Development
http://www.knology.net/~heaven
Jesus is LORD!
Edited by - Heaven on February 19, 2002 6:05:41 PM
you are talking about pathfinding, look up for A* (A Star) tutorials on how to do it,
basically you need to have an integer (or any type you like) array the same size of your tilemap, each element of the array will represent a tile, you must initialize all those to -1, then based on the tile clicked (Goal) and the tile "Joe" is standing over, you assign numbers to the array, the Goal tile gets 0, and all 8 tiles around it get 0+1 = 1, unless there is an object over that tile, then you iterate on each of the surrounding tiles, and give the surrounding tiles the value 1+1 = 2, and so on untill you have assigned a value to all the tiles.
then you check the value of the tile "Joe" is standing over has, say it has 8, you check all the surrounding tiles for that tile, and move joe to the tile that has a lower value than 8 (which will be 7), and repeat until joe is standing over 0.
IF Joe is sealed inside a room and you click outside that room, the tiles inside the room will not get a value, so they will keep the default value -1, so if you check the value of the tile joe is standing over, and find -1, sorry, he cant go were you wanted him to go.
basically you need to have an integer (or any type you like) array the same size of your tilemap, each element of the array will represent a tile, you must initialize all those to -1, then based on the tile clicked (Goal) and the tile "Joe" is standing over, you assign numbers to the array, the Goal tile gets 0, and all 8 tiles around it get 0+1 = 1, unless there is an object over that tile, then you iterate on each of the surrounding tiles, and give the surrounding tiles the value 1+1 = 2, and so on untill you have assigned a value to all the tiles.
then you check the value of the tile "Joe" is standing over has, say it has 8, you check all the surrounding tiles for that tile, and move joe to the tile that has a lower value than 8 (which will be 7), and repeat until joe is standing over 0.
IF Joe is sealed inside a room and you click outside that room, the tiles inside the room will not get a value, so they will keep the default value -1, so if you check the value of the tile joe is standing over, and find -1, sorry, he cant go were you wanted him to go.
Hello!!!! I had a lot of coffee!!! so i use alot of !!! !
I understand pathfinding alright...
Wondering what i need to store for Joe... his coordinates and if he is on the move or not,his destination, also probably his health!
How many different frames might i need if he can walk in 8 different directions and also shoot in eight different directions!
16 or maybe 32 if my animation is to look pretty good!!
Storing my tile info in a map.txt file trying to get something very simple going at first!!
I understand pathfinding alright...
Wondering what i need to store for Joe... his coordinates and if he is on the move or not,his destination, also probably his health!
How many different frames might i need if he can walk in 8 different directions and also shoot in eight different directions!
16 or maybe 32 if my animation is to look pretty good!!
Storing my tile info in a map.txt file trying to get something very simple going at first!!
here is a simple thingie I wrote way back (I mean wayyyyyyy back)...
http://www.geocities.com/roam_fire/DemoFiles/TwoLayerTile.zip
use left-mouse-button to move the dude,
right-mouse-button to change the visible area
and the arrow keys just to scroll around..
graphics is my own work, crap for short, its not optimized so don''t mention it to me.
oh, it was compiled with debug info and not full-screen.
you can find more demoes here:
http://www.geocities.com/roam_fire
cheers
(: I am what I am, more or less
http://www.geocities.com/roam_fire/DemoFiles/TwoLayerTile.zip
use left-mouse-button to move the dude,
right-mouse-button to change the visible area
and the arrow keys just to scroll around..
graphics is my own work, crap for short, its not optimized so don''t mention it to me.
oh, it was compiled with debug info and not full-screen.
you can find more demoes here:
http://www.geocities.com/roam_fire
cheers
(: I am what I am, more or less
oops I forgot,
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
(: I am what I am, more or less
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
(: I am what I am, more or less
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement