How To

How to do collisions with tiles on the map editor

1

Tinycloud778 2019-02-28 19:52

How do you make a sprite that collides with things on the map using the map editor


Timo 2019-02-28 21:33

There is no special command for it, but you can do it like this:
Get the sprite position in pixels, divide them by 8 to get the cell position (column/row) and check which character is in that cell.
Tomorrow I’ll write a little example.


Tinycloud778 2019-03-01 01:32

Ok thanks


was8bit 2019-03-01 05:34

I do this in my game "Toobit saves Bitville game)

Also, I do it in "Game making skills chapter 3"

If your Sprite isn't a precise factor of 8x8 you have to check all other possible cells it might be touching... of SX,SY is the sprites pixel location (top left corner) use characternumber=CELL.C(SX\8,SY\8) to read the contents that the upper left corner of the Sprite is touching... add +1 to either x or y to read other possible cell touches


In my "Player playground test" i am trying to keep the Sprite movement controlled so it always "stops" precisely lined up on a cell block... its tricky though keeping the movement smooth...

In my latest game "Bugsy Battle game" I abandoned sprites entirely.. i use several tricks to pull that off but the advantage is things are cell to cell only and I move actual characters that are on the background, letting me have hundreds of moving things :)


was8bit 2019-03-01 05:35

... none of these are meant as tutorials, so perhaps you might need a small piece of code to review??


Tinycloud778 2019-03-01 11:21

Hey Timo I was just asking if we can use LowRes NX to make games for game jams and I’m going to follow the guidelines by NEVER making the game with money


Tinycloud778 2019-03-01 11:23

Oops no making the game with money I meant NEVER making the game payed


Timo 2019-03-01 11:48

Of course, use NX for jams :)


Tinycloud778 2019-03-01 18:41

Ok thanks because I’m making a game for a game jam


BlockHead 2019-03-15 11:25

Actually I’m working on an platform, if you need better collisions text me


Log in to reply.