How do I add a sort of recall power

Get help using Construct 2

Post » Tue Jan 10, 2017 7:51 pm

So I am making an assignment for class, and I am trying to make a power like tracer's (overwatch) recall. I have it so it is recording my time in game, and x and y positions and I need to figure out how I would format a command so it is "Set Player X and Y to Time-5" can someone tell me how to do that?
B
2
Posts: 7
Reputation: 166

Post » Wed Jan 11, 2017 9:27 am

I would make a bi dimensional array (or 2 arrays, one for X position and one for Y position). Every tick, push front the current X and Y position into the array. If you need to go back 5 seconds in the past, then you'll have 300 (60 tick per second * 5) entries in each array.
Every tick, delete entries at index > 299 (if you don't need to recall farther than 5 seconds)

When the ability is used, just load the values at 299 if they exist, or the highest index values if they don't (which means the player didn't played for 5 seconds yet). You probably have to empty the arrays, too.

If you're unfamiliar with arrays, I strongly recommend reading this : https://www.scirra.com/tutorials/307/ar ... ers/page-1

Hope it helps! Good luck!
B
23
S
5
G
1
Posts: 335
Reputation: 2,406

Post » Wed Jan 11, 2017 3:11 pm

Ok thank you so much!
B
2
Posts: 7
Reputation: 166

Post » Wed Jan 11, 2017 3:29 pm

although im a bit confused on how to exactly "push the position" onto the array, is it something
B
2
Posts: 7
Reputation: 166

Post » Thu Jan 12, 2017 10:07 am

For some reason I can't see the end of your previous comment.
Anyway, I made a capx for you in case you need it :
https://www.dropbox.com/sh/5jrefml0l78w ... mqTGa?dl=0
Just press spacebar to use the recall.

Here is the image :
Image
B
23
S
5
G
1
Posts: 335
Reputation: 2,406

Post » Thu Jan 12, 2017 6:34 pm

Image didnt post, but again tysm! I will get it and hopefully finish
B
2
Posts: 7
Reputation: 166

Post » Thu Jan 12, 2017 7:37 pm

ok I added it but it keeps on spawning me from the top of the layout, is there a fix to this? I am creating a platformer so it might be a bit diffferent
B
2
Posts: 7
Reputation: 166


Return to How do I....?

Who is online

Users browsing this forum: alextro, Manubis, Ryan Kocourek, TheSupreme and 13 guests