Simple Jump 'n' Run

Advanced game related topics
gas01ine
User
User
Posts: 10
Joined: Sat Aug 02, 2003 5:12 pm
Location: Austria / EU

Simple Jump 'n' Run

Post by gas01ine »

I just started out with PB and encountered some problems making a simple Jump 'n' Run. Maybe some of you could help me....

Just imagine an good ol' Super Mario JnR

1. Collision
Is there a way to check the collision only on the top of each sprite? I mean if an enemy sprite hits you from the left or right the player should die but if you jump on it, the enemy should die.

2. Gravity
I solved the jumping via a sin(angle) but thats not the fat of the land actually. Especially when the player drops from a high block

3. Levels
I think tilemap-levels do best in my case. But i have no idea how to realize it. I thought of Mappy, but there are no PB-libs or anything like that on their homepage.

And PB has to check all sprites (+ animations) for collisions and stuff and i suppose this uses a LOT of CPU time if the whole level plus collisions for the coins the player collects, the movement of the enemies and stuff like that.

Thanks in advance. I hope someone has some nice lines of code to help me out ;)

Greetings
gas01ine
User avatar
Flype
Addict
Addict
Posts: 1542
Joined: Tue Jul 22, 2003 5:02 pm
Location: In a long distant galaxy

Post by Flype »

hello,

About the tiles scroller, i've just made one which works very nicely (smooth, low cpu comsuption and comprehensive -i hope -). As my source code make use of some pictures, i can't post it here. So send me an email here : flipemaillist@altern.org

My piece of code was quite design to work with Mappy .MAP file format... Also, the scroller can support multidirectionnal - 32x32 - animated tiles. It "should" work also with 16x16 or any size. But you should have the "PureTools_I purebasic library coded by Danilo" for the animated feature.
As i just started to code it yesterday (lukky man :wink: ) my piece of code isn't in any way a Mappy PBLib style, and will never be i think. But source code is very similar to C generated one by Mappy which is optimized enough. So go for it and ask me for any question on how to embed it into your project.
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
User avatar
Flype
Addict
Addict
Posts: 1542
Joined: Tue Jul 22, 2003 5:02 pm
Location: In a long distant galaxy

Post by Flype »

about collision :
Resultat = SpritePixelCollision(#Sprite1, x1, y1, #Sprite2, x2, y2) may be one way to do it...
i suppose this uses a LOT of CPU time
Yes of course but if you code it well enough it will be ok. I tested heavy calculations and hundred sprites displayed at same time. Purebasic is really fast, impressive... For instance, i tested my scroller with more than 800 sprites on screen at 60 frame per secondes (in 640x480x16bit), so don't be worried about it :P
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
User avatar
Flype
Addict
Addict
Posts: 1542
Joined: Tue Jul 22, 2003 5:02 pm
Location: In a long distant galaxy

Post by Flype »

ho by the way, you should download this lib by Danilo which offers you a complete set of functions for animated sprites... Use it and you will be surprise of its simplicity.
Direct download can be found in this post :
viewtopic.php?t=7046
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
Post Reply