How do I make 2 objects follow a predefined path

Get help using Construct 2

Post » Tue Nov 15, 2016 5:26 pm

Hey guys,

I have a path and the x and y coordinates are in an array.
Object 1 reads the x and y coordinates and starts moving. How do I make object 2 read the array from the beginning while object 1 is still getting data from the array?

Greetz,

Justin
Image
B
41
S
9
G
6
Posts: 77
Reputation: 5,286

Post » Tue Nov 15, 2016 6:17 pm

I figured it out. I have 10 instances:

global variable i=0

Instance 1 starts at i (i=0 zero-based in the array)
Instance 2 starts at -10+i = -10 element in the array
Instance 3 starts at -20+i = -20 element in the array

and so on and so on....

add 1 to i and everything moves up 1 position

So on start of layout I draw an attack wave with circular motion holding down the mouse button, the x and y mouse coordinates are then stored in the array, when the mouse button is released the enemy sprites load in the coordinates from the array one by one....this is cool if you want to make a game like Gyruss, Tempest or Galaga. These games have predefined attack waves :)
Image
B
41
S
9
G
6
Posts: 77
Reputation: 5,286

Post » Tue Nov 15, 2016 6:22 pm

I am not sure but i think you can have the same thing done by using the Pathfinding Behavior.
Not sure though, it's been years since i used that behavior but i am confident it can though.
The Things you can create is only limited by your imagination. If you don't have the skills then use your motivation as a natural force to exceed all expectations. Chadori RebornXD
B
65
S
21
G
90
Posts: 1,124
Reputation: 59,862

Post » Tue Nov 15, 2016 6:27 pm

Hi chadorireborn,

I tried Pathfinding but it doesn't give you much control. In Pathfinding you have to make obstacles, right? Recording the mouse movement and then storing the data and reading it back in requires no obstacles. All you have to do is draw out the attack wave. Editing the data in excel gives you more control. But that's my opinion. I will make a link to the .capx file :)
Image
B
41
S
9
G
6
Posts: 77
Reputation: 5,286

Post » Tue Nov 15, 2016 6:32 pm

So here is the link:

https://app.box.com/s/1md304bnnrgb3i7wguu7kyrzvf8kt2hj

Just hold down the left mouse button while drawing the path. When done release the mouse button.

Greetz,

Justin
Image
B
41
S
9
G
6
Posts: 77
Reputation: 5,286

Post » Wed Nov 16, 2016 8:10 pm

I updated the link.

Hold down the left mouse button while drawing the path for a single attack wave.
Hold down the right mouse button while drawing the path for a double attack wave. (Like in Gyruss :) I love that game)

All data is stored in the array. Let me know if this was helpful.

Greetz,

Justin
Image
B
41
S
9
G
6
Posts: 77
Reputation: 5,286


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 23 guests