Gameboy Development Forum

Discussion about software development for the old-school Gameboys, ranging from the "Gray brick" to Gameboy Color
(Launched in 2008)

You are not logged in.

#1 2017-10-21 12:01:58

turrican1024
New member
Registered: 2017-10-20
Posts: 6

ZGB Tile collison ?

Hi ,

I've edited the code in the ZGB tutorial to make a platformer instead of 4 directional scrolling.

I have the character jumping, falling and moving left to right.  However I need to do collision with a tile.

How would I write :

If (JUP && colliding with tile 1) {

jump = 1;

}


This code is to be used  in the SpritePlayer.c

Bcause at the moment  the player can jump in mid air.  I would like to only be able to jump if colliding with a platform tile.

Thankyou.

Offline

 

#2 2017-10-21 14:58:13

turrican1024
New member
Registered: 2017-10-20
Posts: 6

Re: ZGB Tile collison ?

Ahh got it working.

Heres the code if anybody else runs into map tile collision problems.

if(KEY_PRESSED(J_UP) && goingup==0 && scroll_collisions[GetScrollTile(((THIS->x + THIS->coll_x) >> 3), (THIS->y >> 3) + 2u)]) {
        goingup=1;

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2005 Rickard Andersson