I need a code example.

BlitzMax Forums/BlitzMax Programming/I need a code example.

Pineapple(Posted 2009) [#1]
I, sadly, have come across an obstacle that seems quite easy to overcome, but have been relentlessly trying to get it to work and I just can't. I need some sort of example to look at.

I'm coding a tile-based sidscrolling game. I cannot for the life of me get the character to simply move left & right, jump and fall, among the tiled world. Please help me!


sswift(Posted 2009) [#2]
The world isn't moving. The camera is.

Store object in your world with a set of global coordinates. Use these coordinates for collisions and things.

Then when you need to draw a frame, transform those coordinates to camera space before drawing. Take the camera's location in the world, and subtract it from the coordinate of the object. That's the cooridnate on the screen it should be drawn at.


Armitage 1982(Posted 2009) [#3]
Hi B+man

Look here : http://www.tonypa.pri.ee/tbw/start.html
Of course it's Flash based code but this can be very easily converted to any other languages.

Also, you could try a physics engine like the one available in the Brucey Forum called Box2d.
I'm sure you can achieve great things with this engine. All depend of your needs.


Amon(Posted 2009) [#4]
Have a look here. It was some time ago but jesse helped me sort it. In the thread is tilemap collision code for platform sidescrolling games or single screen games.

http://www.blitzbasic.com/Community/posts.php?topic=84117#950100

Also searching Platform under my name gives these results. You should find something useful there.

http://www.blitzbasic.com/Community/_search.php?bbs=&forum=&terms=platform&method=simple&case=no&results=topic&user=Amon&submit=Search+in+new+window


Pineapple(Posted 2009) [#5]
Looks good amon, Thanks.

Look forward to (maybe, hopefully, possibly) "Icarus Forever", a clone of the original NES game.