Zal0 / ZGB

Game Boy / Color engine with lots of features
MIT License
708 stars 50 forks source link

Check specific tile at specific location ? #26

Closed rodentcat closed 3 years ago

rodentcat commented 3 years ago

Hi !

I was wondering about something. I'm trying to make a game where you get to stick to walls and ceilings and stuff, but I can't figure out how to check the collision tiles at a certain point. I'm mainly wondering what the .... command ? is that the word ? I'm wondering what the command is for that. I thought "GetScrollTile" might do the trick, but.... Yeah, that's not working.

image

If it doesn't exist already, I was wondering if you could add it ? I've been looking through the include files for anything that could help, but... I couldn't find anything. Maybe I'm blinding on it...

aiguanachein commented 3 years ago

As far as I kwow GetScrollTile should do the trick, but you need to add the shifting to each coordinate GetScrollTile(THIS->x >>3, (THIS->y + 2 )>>3) == 1) Anyway, if the tiles you want to check are collideable TranslateSprite function returns the tile number if the sprite and tile collide.

rodentcat commented 3 years ago

Thank you so much ! It worked ! :D The reason I'm not doing TranslateSprite is because you're able to jump again when you hit a ceiling. I'm probably doing something wrong, but for the game I'm doing, I want you to be able to stick to the ceiling, and by extension, walls.

Zal0 commented 3 years ago

I am closing this since it doesn't look like a bug