Tiles

Non-platform specific questions.

Tiles

Postby Caaz Games » Mon May 25, 2009 3:44 am

How would i make a tile based game?
like pokemon style, where he takes a couple steps and always lands on a tile.
and i'd also like to know how to make where it just jumps, thanks and +1 to whoever tells me :D...

i'm not sure what size things will be so please tell me how i can manipulate it so that it will be good for all sizes.
and later i would need gravity using these. thanks.
You are welcome to join my forum. 4 active members lol but it's a cool place. active... much talking :D it's fun!
http://caaz.freeforums.org/
User avatar
Caaz Games
 
Posts: 729
Joined: Wed Feb 14, 2007 9:09 am
Location: California....knows how to party!
Score: 25 Give a positive score

Re: Tiles

Postby skydereign » Mon May 25, 2009 4:29 am

Well, these are some possible ways. You can pick whichever, depending on what you are comfortable with. One way is to use a two-dimensional array to hold the tile types, then the actor checks if the spot is available. Another method is to just make sure the actor moves a tile at a time, and while moving, checks if the next spot is open, with CollisionFree. You can also have actors check if there is a collision, a north tile, south tile, east tile, and west tile. They change variables depending on collisions. For the actual moving, you can either do it animation based that has a variable that controls movement, so you only can move again if on the animation finish of a move, if the key is down, then move again. In that code, you would need a type of recognition of other tiles. The animation itself would start with a frame of the player standing, and the end would result in him being in the neighboring square. Then the the finish of that animation, it sets the x or y accordingly. By jump do you mean no transition walking? Also, how would you add gravity to a tile based game? Maybe you are thinking of something else... But anyway, the animations can either make the transition smooth or not. Also you could use variables to control when the player stops moving... If any of these sounds good, I can explain them further. If none of these seem right, I can explain other methods.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Tiles

Postby Caaz Games » Mon May 25, 2009 5:14 am

well, i want' to make a game like this...
http://www.neopets.com/games/play.phtml ... ality=high
you can push stuff around and ballons go up tiles, and rocks go down, the player moves freely without gravity.
it's all tiles, and if you play it you'll see what i mean by 'jumping' the guy just flashes through the tiles...
tiles will be 60x60 for me... thanks again.
You are welcome to join my forum. 4 active members lol but it's a cool place. active... much talking :D it's fun!
http://caaz.freeforums.org/
User avatar
Caaz Games
 
Posts: 729
Joined: Wed Feb 14, 2007 9:09 am
Location: California....knows how to party!
Score: 25 Give a positive score

Re: Tiles

Postby skydereign » Mon May 25, 2009 5:38 am

Okay, well the player movement would be really easy. I would probably use an array to determine each spot. Not sure if it is the best way though..
Code: Select all
#define dimX 10
#define dimY 10
int MAP[dimX][dimY];

Then, depending on what each sub has, you can move or not. The balloons and rocks check if their is a certain object above or below them, represented by some number. If there is not, then it will rise. The actor itself would be placed on the grid, and if the spot is available, then you can move by adding 60 to your x or y value. These would be good to look at before you really try anything, even if you don't use the methods within, it gives a good idea of what factors exist in tile based games, or gives a general idea of keeping track of where things are and whatnot. I could make a simple demo if need be.
http://game-editor.com/forum/viewtopic.php?f=5&t=6569&start=0&hilit=strategy
http://game-editor.com/forum/viewtopic.php?f=5&t=6568&start=0
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Tiles

Postby Caaz Games » Mon May 25, 2009 6:19 am

yes a demo would be nice :D you're really helpful.
You are welcome to join my forum. 4 active members lol but it's a cool place. active... much talking :D it's fun!
http://caaz.freeforums.org/
User avatar
Caaz Games
 
Posts: 729
Joined: Wed Feb 14, 2007 9:09 am
Location: California....knows how to party!
Score: 25 Give a positive score

Re: Tiles

Postby DST » Mon May 25, 2009 9:39 pm

I would go with the array method, because it will allow you to add custom maps without having to recompile the game, and
you may at some point want to use a custom level editor (that you make in ge), and arrays can be easily stored to txt/dat files and reopened.

An array would allow you to add complex pathfinding, and you can determine cell contents by real values; the cell either is 1 grass or 2 rock or 3 water. This would make it easier to add quantum effects to the map (like if a forest were burned down, or if the level was flooded with water).

And will also expand your understanding of game making and data handling.

CollisionFree or collision with an child collider are way less efficient that simply checking cell integers, even if they may be simpler to use at first. They also can't be customized or have maps added, and require you to build huge maps inside of ge.

The more stuff you add in the editor mode, i.e. actors, clones, and tiles, the closer you get to overloading the program and crashing the game.
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score

Re: Tiles

Postby skydereign » Thu May 28, 2009 2:16 am

Here you go, this just gives a general idea. It is not perfect, really a very rough sketch of what a tile game should be or use.
Attachments
tile.zip
(3.56 KiB) Downloaded 90 times
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Tiles

Postby Caaz Games » Sat May 30, 2009 3:49 am

Okay so i've been looking at the code and stuff, and there's one thing i need to understand...
Code: Select all
x=X*60;
y=Y*60;

my best guess is that's how big the tile is... 60px by 60px, and you used X to mean 1=60 so when you say X++; that would move it one over, right? so if i change 60 to say... 10, it would instead be 1=10 so everytime it would go it would move 10px?...

and the player's draw actor, it's complicated... i need some understanding on the way you have the keydowns, i've tried using it but it failed miserably.
You are welcome to join my forum. 4 active members lol but it's a cool place. active... much talking :D it's fun!
http://caaz.freeforums.org/
User avatar
Caaz Games
 
Posts: 729
Joined: Wed Feb 14, 2007 9:09 am
Location: California....knows how to party!
Score: 25 Give a positive score

Re: Tiles

Postby skydereign » Sat May 30, 2009 4:05 am

Yes, all the references to 60 would be switched to 10. You might as well #define that, or use the width of your tile. My computer is broken right now, essentially the graphics don't work, and so I can't look into the draw code right now, but I can explain what I think I did. The main idea behind it, I don't like using keydown events, I tend to do everything in draw... so you could split it us, because all it does is check the spot you are moving to. So instead, use just say, keydown right. In this, it will have a switch statement, using the tile array with the coordinates of x+1, y, the subs. If it is 0, case 0, then move there and adjust the array you are on. What it is doing for that is setting the xy you are on to 0 and moving your xy right one. If there is a wall, case 1, then do nothing. If there is a rock, case 2, move the rock and move the actor. This is the general idea of the draw, if I can get my computer working, I could make a commented demo, not using the draw script for it. That is if this explanation did not help.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Tiles

Postby Caaz Games » Sat May 30, 2009 7:25 am

no no, the demo helped alot :D. +1
just some little things i'm wondering about :P
like in the rock's draw

Code: Select all
x=X*60;
y=Y*60;

if(Y<MaxY-1 && objectGrid[X][Y+1]==0)
{
    objectGrid[X][Y]=0;
    Y++;
}
objectGrid[X][Y]=2;

now i get what controls the cases, that last line, right?... and how this gravity works, Y keeps getting added ++; so it goes one tile down, and how it checks if something is onder it... but what's
Code: Select all
if(Y<MaxY-1 && ...

i'm not familiar with that part.
... if i put this on a timer the gravity would go slower right? ...
and now i understand why i can push rocks into the wall and go through the wall, by pushing it...

and one more thing, i've noticed that the grid is limited, yet i found no place where it referenced that fact... and where i could edit it.

PS. yay learned like 7 things while looking through this... PPS i found out why i messed up the draw actor keydown script :P
You are welcome to join my forum. 4 active members lol but it's a cool place. active... much talking :D it's fun!
http://caaz.freeforums.org/
User avatar
Caaz Games
 
Posts: 729
Joined: Wed Feb 14, 2007 9:09 am
Location: California....knows how to party!
Score: 25 Give a positive score

Re: Tiles

Postby skydereign » Sat May 30, 2009 7:32 am

That is too limit the rock from going beyond the bounds of the grid, which would leave the array, causing gameEditor to crash. And yes, putting a timer on that event would slow down the fall of gravity. The grid itself is limited by the size of the array. I believe if you look at the movement codes, like in that of the player, it will have less than or greater than, those make sure you stay in the bounds of the array. You can change the size/dimensions in global code. As far as fixing the problem with pushing rocks through walls, you would just need a second check.
User avatar
skydereign
 
Posts: 3510
Joined: Mon Jul 28, 2008 8:29 am
Score: 589 Give a positive score

Re: Tiles

Postby Caaz Games » Sun May 31, 2009 6:24 pm

thank you! i understand it all, i think, and i need more help i'll come back :P
You are welcome to join my forum. 4 active members lol but it's a cool place. active... much talking :D it's fun!
http://caaz.freeforums.org/
User avatar
Caaz Games
 
Posts: 729
Joined: Wed Feb 14, 2007 9:09 am
Location: California....knows how to party!
Score: 25 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron