Testing Pixel Point contact between sprites and background cells...


was8bit 2020-12-31 05:20 (Edited)

This is done by reading cells in the background, creating test sprites from those cells, placing these test sprites on top of the cells, and testing with SPRITE HIT, then removing those test sprites...

The result is pixel perfect testing of the background cells.. :)

Falling is done... also, going down hill is done..

... need to add going uphill... when done, worms should automatically climb up hills....

V0.2 getting the math right for checking collisions while walking left/right... actually, the math is still not right :/

Worms Test.nx | Open in app
2020-12-31 05:20

G-9 2020-12-31 09:23

Exactly what i was looking for !!
Collisions are kind of hard ...

GAMELEGEND 2020-12-31 14:31

I tried this a few weeks ago but couldn't get it right

was8bit 2020-12-31 15:40 (Edited)


... i use 2 sprites, as often when falling it usually will not precisely only hit one... you can temporarily add WAIT VBL or even WAIT 5 near the end of the FALL sub to see the sprites i add ;)

The math i use takes into account that a sprites (and cells) coordinates are located at the top left corner... so if a sprite moves one pixel beyond that point it picks up an entirely new cell, while still stradelling the old cell...

Also, HIT doesnt register until the sprite is already touching, so the math backs the sprite up 1 pixel to account for that...

... going up the hill will require more care, and i havent tackled that one yet..

Tinycloud778 2020-12-31 17:44

this is cool

was8bit 2021-01-01 03:05

Thanky :)

... most of the time i only get a few moments of time to work on stuff, a lot of it never gets posted but little things like this i post... especially since i "HOPE" that this can turn into a real worm game one day...

... but, baby steps... a little at a time.....

Log in to reply.