Hello, thanks for visiting GameML, if you are a Game Maker user, this is the site for you, please sign up, or login if you are already a member, or just browse the site! Welcome to GameML!

ATTENTION MEMBERS!!! USERS CAN NOW SIGN UP AGAIN!
Log in

I forgot my password

Search
 
 

Display results as :
 


Rechercher Advanced Search

Site Hits
Free hit counter
These stats started at 0 on July 7th 2009
GameML File Sharing
USERNAME: gamemladmin@gmail.com PASSWORD: gamemlsite Upload Here: http://gameml.iowoi.org/GameML-File-Sharing-h3.htmPlease add only games.
Create A GAMEML BLOG!
Make a Blog on GameML:http://gamemlblogs.wetpaint.com
Keywords


Worm/Snake code

View previous topic View next topic Go down

Worm/Snake code

Post by GoldenBeastStudios on Fri Jan 29, 2010 10:49 pm

I'm attempting to make a worm/snake kinda enemy, but I can't seem to get the body segments to follow the head in a logical way. I'm basically trying to use the xprevious and yprevious of the head, except it needs to be the 30th previous x and y, so that body segments follow the head, but not right next to it (thus reducing the number of objects needed). Here's a pic of what I'm trying to do:



Any pointers anyone?

John
avatar
GoldenBeastStudios
GameML Adventurer
GameML Adventurer

Posts : 117
Points : 29824
GameML Reputation : 2
Join date : 2009-07-09
Age : 34
Location : Austin, Texas

View user profile http://www.goldenbeaststudios.com

Back to top Go down

Re: Worm/Snake code

Post by Sparx the Cy-Wolf on Sat Jan 30, 2010 2:09 pm

It's a long shot, but have you thought about usig alarms on each segment that differes for each one, for instance the second segment would differ in time from the first one by, let's say "10" beofre it does the same "action" when following the first, while the third one would differ by "20" from the first and....you get the idea?
avatar
Sparx the Cy-Wolf
Admin
Admin

Posts : 1775
Points : 31885
GameML Reputation : 5
Join date : 2009-06-07
Age : 26
Location : Mother ship

View user profile http://www.yoyogames.com/members/Sparx%20the%20Cy-wolf

Back to top Go down

Re: Worm/Snake code

Post by The SNIC on Sat Jan 30, 2010 3:00 pm

to difficult. Probably will not work. I say you just make several segments as different objects. make one segment move towards another segment like: for part3 move_towards_point(part2.x,part2.y,3) then make qa mask for all of them andif it collides with that object, stop following. theres an AI gm7 video for a AI partner. It has how to keep distance, use that following code(all of it) in your thing!

_________________
My site is new and good! and it's going to be able to host games and stuff! Check it out! http://cazigeneration.vampire-legend.com/index.htm
avatar
The SNIC
Moderator
Moderator

Posts : 677
Points : 30450
GameML Reputation : 4
Join date : 2009-07-10
Age : 1008
Location : MI

View user profile http://www.youtube.com/gigaroid

Back to top Go down

Re: Worm/Snake code

Post by Sparx the Cy-Wolf on Sun Jan 31, 2010 6:03 am

yeah I guess that could work to.....
avatar
Sparx the Cy-Wolf
Admin
Admin

Posts : 1775
Points : 31885
GameML Reputation : 5
Join date : 2009-06-07
Age : 26
Location : Mother ship

View user profile http://www.yoyogames.com/members/Sparx%20the%20Cy-wolf

Back to top Go down

Re: Worm/Snake code

Post by fooey on Sun Jan 31, 2010 9:10 am

i did this once to give a trail to the mouse, that the trail was just a line.

it involves alarms and variables.
ok simple on alarm0 (which is 10 steps long): jump part1 to x1,y1 then jump part2 to x2,y2 ect... then set x3,y3 to x2,y2 then x2, y2 to x1,y1 then x1,y1 to whatever the main object is.

_________________
we are the champions - my friends
And we'll keep on fighting - till the end -
We are the champions -
We are the champions
No time for losers
'Cause we are the champions - of the world -
avatar
fooey
Moderator
Moderator

Posts : 1422
Points : 31150
GameML Reputation : 1
Join date : 2009-07-10
Age : 22
Location : here

View user profile

Back to top Go down

Re: Worm/Snake code

Post by The SNIC on Sun Jan 31, 2010 3:15 pm

uh, I think he solved it, but let me check to make sure...

_________________
My site is new and good! and it's going to be able to host games and stuff! Check it out! http://cazigeneration.vampire-legend.com/index.htm
avatar
The SNIC
Moderator
Moderator

Posts : 677
Points : 30450
GameML Reputation : 4
Join date : 2009-07-10
Age : 1008
Location : MI

View user profile http://www.youtube.com/gigaroid

Back to top Go down

Re: Worm/Snake code

Post by 65loconut on Sun Jan 31, 2010 6:31 pm

Woah! Looks tough! I could never do this! Tell me how to do it when your done!
avatar
65loconut
GameML Noob
GameML Noob

Posts : 8
Points : 27615
GameML Reputation : 1
Join date : 2010-01-31

View user profile

Back to top Go down

Re: Worm/Snake code

Post by CarnivorousA on Mon Feb 01, 2010 4:16 am

Usually I'm a man of action but this has got me fucked.
Using xprevious would pretty much make them right inside each other, but all of them moving towards the next one will probably not work that way...

_________________
avatar
CarnivorousA
Moderator
Moderator

Posts : 1402
Points : 31982
GameML Reputation : 17
Join date : 2009-06-01
Age : 23
Location : At the bottom of the lake.

View user profile http://entertainmypeople.freeforums.org/index.php

Back to top Go down

Re: Worm/Snake code

Post by Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum