Yoshi's Island eggs

Get help using Construct 2

Post » Fri Nov 22, 2013 1:20 am

Actually that .capx I just linked to might not be the best way to go about this - the array is endlessly growing in size.

This is as far as I got : Eggs.capx
Image
B
243
S
30
G
13
Posts: 1,787
Reputation: 18,770

Post » Fri Nov 22, 2013 1:24 am

Nope, it keeps popping the array. They will get big, but never above X amount. I tried running about for ages with no issues. Yours is looking good though, I'm just not too good at long formulas ^^

EDIT: The array cells are 100 for the lowest and 220 for the highest, never going above.Tobye2013-11-22 01:27:06
B
28
S
8
G
5
Posts: 429
Reputation: 7,007

Post » Fri Nov 22, 2013 1:53 am

Ok now it's actually solved. Re-download the .capx in my last post if you want to check it out!
Image
B
243
S
30
G
13
Posts: 1,787
Reputation: 18,770

Post » Fri Nov 22, 2013 2:12 am

Glad I could help ^^
B
42
S
17
G
17
Posts: 2,247
Reputation: 17,471

Post » Fri Nov 22, 2013 4:42 am

*sigh*

The lower the timescale, the closer the eggs follow eachother. Not sure how to apply dt to this one. Any ideas?
Image
B
243
S
30
G
13
Posts: 1,787
Reputation: 18,770

Post » Fri Nov 22, 2013 8:53 pm

Hi, I got it working so that the eggs stay a certain time delay behind the player.

https://dl.dropboxusercontent.com/u/5426011/examples20/yoshi_eggs_time.capx

I changed a few things to get it to work. First in addition to x and y I also save the time. This is so I can find the saved position just before and after a certain time. If the first egg would is half a second behind the player then I would find the positions closest to time-0.5. After that I can then interpolate between the positions with lerp. The send thing I change from the original is add to the front of the array instead of the back so I could trim off the excess with a set size.
B
94
S
33
G
113
Posts: 5,356
Reputation: 73,273

Post » Fri Nov 22, 2013 9:08 pm

Perfect! Thanks man. I appreciate you describing the changes too.
Image
B
243
S
30
G
13
Posts: 1,787
Reputation: 18,770

Post » Fri Nov 22, 2013 9:13 pm

@R0J0hound - cool, it looks great :) Even though this isn't my problem, I can see myself using the solution somewhere down the track.
B
28
S
8
G
5
Posts: 429
Reputation: 7,007

Post » Wed Jun 17, 2015 11:50 am

Hi guys, sorry to unbury the thread, but I am currently working on an old project of mine, which uses a similar functionality. I successfully implemented @R0j0hound solution, but I am struggling with one detail:

The programming was made for a group of eggs already caught by the player, but let's say that I caught one more egg. What would be a good way of programming it to join the the other eggs as the last in line?


Cheers!
B
14
S
6
G
3
Posts: 102
Reputation: 3,997

Post » Wed Jun 17, 2015 6:36 pm

@pcfernandesjr
In that example just adding another egg works fine to add it to the end. If you want the eggs to be ordered in the way you collect them you could do something like this to assign a number to the eggs you collect:
Code: Select all
global index=0

on player collided with egg
egg is not collected
for each egg
--- egg: set collected to true
--- egg: set num to index
--- add 1 to index


Then change the "for each" in the example to

egg is collected
for each egg ordered by egg.num ascending
B
94
S
33
G
113
Posts: 5,356
Reputation: 73,273

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: No registered users and 46 guests