-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|605|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
SoCoder -> Blogs Home -> Blogs


 
waroffice
Created : 12 October 2010
 
System : Mac

No more interface troubles



I managed to sort out my interface troubles last night. I stuck to the text based entry for now, true it means I have to remember the flag values but there aren't that many (eight in total). I can now edit each cell's details like as mentioned above, flags to say what the cell can do, any other data like exit map and coords.

I was quickly able to make the engine perform like it is meant to, as you go onto the door of the house, you enter the house and exit the house in a similar fashion.

There is scope for more in the future like visual effects but i will stick to normal functions for now.

I then moved on to collisions, stopping the player going into the next cell. Turned out to be more complicated than I first thought. I have it set so the collision data is based on exiting a tile not entering one. so each tile can have each of the 4 directions enabled/disabled. I ran in to trouble when it came to positioning the player at the right spot when unable to move to the next cell, I worked out the number of pixels for each direction and set about putting the code together. I failed to realise how complex it can get.

Example:



There is a point when the player is far enough left or right to be counted as in the next cell but will be overlapping both cells. I created some debug code that shows where the player is and also what cell it is being rendered on. This showed the problem but I couldn't figure it out in the short amount of time I had.

This is where SoCoder comes in, I'm hoping one of you guys has done something like this before and can point me in the right direction, I'm losing my hair as it is and don't to be bald before my 30th birthday (this November )

If I get time I will try and get some pseudo code down to take home with me.

 

Comments


Tuesday, 12 October 2010, 05:23
Jayenkai
Tiles can definately be bitchy like this, and I used to struggle with these ALL the time!

Be sure you're using the middle of the player, not the player's top-left. That's a killer! If you use their top-left, you have to keep offsetting all your grid stuff, all the collision stuff, and everything else around them, so just offset the player instead.

drawimage playersprite,player.x-16,player.y-16,whatever

Then everything should at least be a teensy bit easier.


(or something to that effect!)

You nearly had it, it was probably the topleft thing that threw you.
Tuesday, 12 October 2010, 06:27
waroffice
ahhhhh the offset is key, just didnt think about using mod for remainder. strange as I use that to calculate where the player and map should be drawn when moving off the edge of the screen.

Cheers Jay, will get on to it (RDP shhhhhh dont tell my boss )
Tuesday, 12 October 2010, 06:47
waroffice
20 mins later and its working fine.

Thanks Jay i owe you a cake