I was working on a simple 2D platform engine. So far I have a sprite moving (not yet animated) and 3 platforms for a game like "Jetpac" (an old ZX Spectrum game - Iβm sure that if you do, you can play it in flash box).
Now I am faced with the problem of implementing collision detection, so the sprite can actually go on platforms. I think this will be the biggest job, and then itβs pretty easy to continue. But how to implement platform collision detection ?!
I have bounding fields for all platforms, as well as a character, and later there will be limited fields for sprites, but this can be processed later. Basically, what is the easiest way to let a sprite walk on the platform, rather than go through it using the Bounding Box?
A bit more info:
- The character element controls sprite drawing and sprite updating using the Vector2 position variable updated with the Vector2 motion variable.
- The platform class controls the drawing of the platforms (there are 3 of them), so plat1, plat2 and plat3 are all types of platforms.
- The platforms must be completely durable on all sides, but allow the sprite to walk.
Any help?
source share