Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / worm physics?

Author
Message
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 10th Jan 2021 02:23
If you haven't played wormzone.io or snake.io then check them out if you're unfamiliar. The mechanics, though I thought would be simple, is giving me a bit of trouble. My snake moves more like a rope in that the tail doesn't move unless I've fully extended its length. What I want is each segment of the snake to continuously move along the path the head of the snake has taken. The coordinates of the snake and it's body segments are in world coordinates, not screen. The head is locked at the center (512,384 in my example) and the background map is offset based on the snake's position to make it look like you're moving. I just can't for the life of me get the body segments to move the way I want.

Tiled TMX Importer V.2
XML Parser V.2
Base64 Encoder/Decoder
Purple Token - Free online hi-score database
Legend of Zelda

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 11th Jan 2021 00:03
From what i can see on the wormzone.io video i'd use a breadcrumb technique
table contains the position of the sprite for the last x moves, if the sprite moves insert position at the top of the array remove the last position
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 12th Jan 2021 19:52
I thought that's what I was basically doing. Starting at the tail and incrementing towards the head, move that segment to where the one in front of it was. Logically, it seems pretty straight forward I thought. I must have a bug in it somewhere.
Tiled TMX Importer V.2
XML Parser V.2
Base64 Encoder/Decoder
Purple Token - Free online hi-score database
Legend of Zelda

"I like offending people, because I think people who get offended should be offended." - Linus Torvalds
blink0k
Moderator
11
Years of Service
User Offline
Joined: 22nd Feb 2013
Location: the land of oz
Posted: 12th Jan 2021 21:43 Edited at: 12th Jan 2021 21:44
You want a solid line you could use breadcrumbs and fill in the blanks. If you want to smooth the line further you could use beziers to interpolate the positions but i reckon that is just overkill for a game


If you want the shapes to be evenly spaced i did a luxor mechanic test that might be more what you're after (See attached)

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-04-18 18:54:08
Your offset time is: 2024-04-18 18:54:08