ID:266487
Mar 20 2002, 3:01 pm
|
|
I'm making a game that's like snake and I need some help. I need to know how to make it so when you eat a dot you get something added on to you like a tail and I can't figure out where to start. Could someone help me with this please?
|
Mar 20 2002, 3:14 pm
|
|
Did you look at ACWraith's trail Demo?
|
In response to Foomer
|
|
Yes, but it was kinda comlicated, and I didn't know how to make it work for my game
|
In response to Super Sonic 4
|
|
You could just have a tail pointer and have the player be the head of the snake.
world mob = /mob/head mob tail head var/mob/tail/T proc New_Segment() tail.icon_state = "body" //make it normal segment var/mob/tail/old = tail tail = new() walk_to(tail,old,0,0) This will need modifying but the principle should work. |
In response to Super Sonic 4
|
|
My Trail library was originally intended for a visual effect, but the following might work...
When the snake eats its first dot, create a trail (using new) with your icon of choice and density equal to 1. layer, animateMovement and opacity are up to you. They just make things look a little different. numMarkers is the initial length of the trail. It defaults to 1. For every dot after that, use AdjustLength(amount) with amount equal to the amount of growth you want. The extra arguments just define how that new part of the tail looks. If you leave them alone they should look like the last part of the tail that was drawn. When the snake moves, use LayTrail() where you want the trail to go. I would maybe use the location the snake was in before the movement and use the direction the snake moved in. NewLoc and Dir are the arguments to define this. The rest are mainly for changing the appearance (and density) on the fly. Where you might run into trouble is trying to bump into the tail. Since I created my library for a visual effect, I hid the things which make up the trail behind the scenes. The object the snake would bump into is an obj/trailMarker if that helps. (Strictly speaking, it's not wise to go behind the scenes in a library. However, by the time I actually change anything that would mess you up, you would probably be able to recreate my library in five minutes anyway. :) ) |