Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: Moldorm Script  (Read 2643 times)

0 Members and 1 Guest are viewing this topic.
Moldorm Script
« on: April 27, 2011, 09:59:26 am »
  • Let's do this.
  • *
  • Reputation: +4/-0
  • Offline Offline
  • Gender: Male
  • Posts: 211
Okay, I am working on a moldorm script.
My problem are the objects, that (follow) the head of the moldorm.
These objects should repeat all what the moldorm head does.
At the moment I haven't an idea for this code.(Object-Repeat-Code)
Do you have an idea?
Logged
This is one of many tales Hylian lore speaks of...

Click here to check out my Deviantart!
  • Zelda Time Walker
Re: Moldorm Script
« Reply #1 on: April 27, 2011, 06:00:51 pm »
  • *
  • Reputation: +1/-0
  • Offline Offline
  • Gender: Male
  • Posts: 446
Moldorm is this dude, correct?


His body parts all follow the same path. ;) You dig?
Logged
Re: Moldorm Script
« Reply #2 on: April 27, 2011, 08:45:37 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 57
Actually, I have been pondering on this for a while, but unfortunately I haven't a clue yet (so I'll watch this thread with interest).I only have the basic head movement and turning down, but even that is still being tweaked.

 It may depend on which game you are trying to emulate though. If you are trying to create a GB or MC moldorm, there is an added issue of making the parts separate and reconnect (this happens whenever they are hit), but I cannot say much about the other games however.

I recommend you look for a snake code on the gamemaker forums. You know those snake games? They may ahve what you are looking for.
Logged
Re: Moldorm Script
« Reply #3 on: April 28, 2011, 06:16:17 am »
  • *
  • Reputation: +1/-0
  • Offline Offline
  • Gender: Male
  • Posts: 446
I should've done more than hint at it, lol. Use paths.


I'll use a recreation of LttP's battle as a model.

Say we have Path_1: that gets created when the player enters the room, and then the Moldorm object follows the path. But what does Moldorm do after he finishes moving over Path_1? It would be boring if he followed the same path again and again.

New addition: Path_2. Path_2 also gets created when the player enters the room. Moldorm follows Path_1, and then Path_2, and repeats them both.

But that's still boring; the paths should be dynamically created as Moldorm moves! Now that's where it gets tricky, because in Game Maker we can't change our path resources while they're in use by the Moldorm object.

Luckily, we have two paths.  XD  Both paths get created when the player enters the room, and then switched back and forth. When one path is in use, the other path gets rewritten, and vice versa.

The head of Moldorm will be using a new path, while one or more of his back segments might be using an old path. Including his head, he has 5 segments in total; let's say as an example that each segment switches paths every 60 frames (random number). The head switches first, and then the next segment, and so on. A segment is switching every 1/5 of the time (5 segments) so there's a segment switching every 12 frames, and that creates the effect that the segments are following one another.

Let's visualize this. All 5 segments start on top of each other. The head moves first; it's set to Path_1. Every 12 frames, another segment gets set to Path_1. After 48 frames, every segment has been set to Path_1. After another 12 frames, the head is set to Path_2. 48 frames after that, every segment has been set to Path_2. That's the time for Path_1 to be rewritten in a semi-random way -- you'll write the algorithm so that it creates the motion that you want it to. Then 12 frames later, the head segment swaps back to Path_1, etc. etc. and 48 frames after that, Path_2 has time to be rewritten, etc. etc. and that cycle continues until it dies or Link dies.


And that's how you'll do it.  ;)  Sounds easy, right?
« Last Edit: April 28, 2011, 06:25:40 am by Nabeshin »
Logged
Re: Moldorm Script
« Reply #4 on: April 28, 2011, 03:25:47 pm »
  • d(-_-)b
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 36
You can store the head movement in an array, I did this example just using one object.

Create event:
Code: [Select]
for(i=0; i<40; i+=1)
  {
  stepx[i] = x;
  stepy[i] = y;
  };

p1 = 0;
p2 = 8;
p3 = 16;
p4 = 24;
p5 = 32;
p1 is the head, the other parts have a distance (in steps) from the head.

Step event:
Code: [Select]
if(keyboard_check(vk_left)) { x -= 1; }
else if(keyboard_check(vk_right)) { x += 1; };
if(keyboard_check(vk_up)) { y -= 1; }
else if(keyboard_check(vk_down)) { y += 1; };

if(x != xprevious or y != yprevious)
  {
  stepx[p1] = x;
  stepy[p1] = y;
  p1 = ((p1 + 1) mod 40);
  p2 = ((p2 + 1) mod 40);
  p3 = ((p3 + 1) mod 40);
  p4 = ((p4 + 1) mod 40);
  p5 = ((p5 + 1) mod 40);
  };
If the head doesn't move then nothing is stored.

Draw event:
Code: [Select]
draw_sprite(sprmoldorm,0,stepx[p1],stepy[p1]);
draw_sprite(sprmoldorm,0,stepx[p2],stepy[p2]);
draw_sprite(sprmoldorm,0,stepx[p3],stepy[p3]);
draw_sprite(sprmoldorm,0,stepx[p4],stepy[p4]);
draw_sprite(sprmoldorm,0,stepx[p5],stepy[p5]);
Logged
Re: Moldorm Script
« Reply #5 on: April 28, 2011, 04:18:51 pm »
  • Let's do this.
  • *
  • Reputation: +4/-0
  • Offline Offline
  • Gender: Male
  • Posts: 211
Thanks! :D
These were the information which I needed.
« Last Edit: April 28, 2011, 10:06:09 pm by Rayo »
Logged
This is one of many tales Hylian lore speaks of...

Click here to check out my Deviantart!
  • Zelda Time Walker
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.057 seconds with 49 queries.