Snake Trail - Example -

Show us your completed creations made in Construct 2

Post » Thu Mar 07, 2013 2:53 pm

Great Job Whiteclaws.
Nice movement. I think I remember you being a bit bent out of shape a while back, because you were having trouble with arrays. So it appears as far as arrays go... you have arrived.
B
20
S
2
Posts: 257
Reputation: 2,431

Post » Thu Mar 07, 2013 4:11 pm

@Auntie Val , All my old array problems were due to one event ... I just had to set the size of the array in the event sheet , Such a shame , so much nice project scrapped for a such little error :(
B
34
S
16
G
16
Posts: 2,222
Reputation: 16,564

Post » Thu Mar 14, 2013 12:34 am

There is a bit of magic going on that I don't understand.

Pos.At(MaxArrayW-10*Crystal.SpawnNumber,0)

What does pos.at( do I cannot find any references to it in the manual.

The problem I am having is that on slower computers the snake's body is drawn far apart. I would like it to reposition the same distance regardless of framerate.

https://www.dropbox.com/s/z1rdls49vnx2ige/SnakeGameTest.capxczar2013-03-14 00:35:53
B
31
S
8
G
5
Posts: 436
Reputation: 5,836

Post » Thu Mar 14, 2013 12:55 am


Pos.At(MaxArrayW-(10*CrystalSpawnNumber)*dt,0)

That should do the work ...

Pos is the name of the array

At() is the expression ...

-Manual
At(X, Y, Z)
Retrieve a value at a position in the array. Indices are zero-based. Reading values outside the array returns the number 0. If the Y or Z indices are not provided then 0 is used.

Cheers @czar ...
B
34
S
16
G
16
Posts: 2,222
Reputation: 16,564

Post » Thu Mar 14, 2013 2:02 am

@Whiteclaws

POS bugger! why didn't I see that?

unfortuentaly Pos.At(MaxArrayW-(10*Crystal.SpawnNumber)*dt,0) doesn't work at all; all the body parts are underneath the head.

I will see if I can work it out. Thanks for your help.
B
31
S
8
G
5
Posts: 436
Reputation: 5,836

Post » Thu Mar 14, 2013 11:11 am

Okay ... Chcking it out this night ...
B
34
S
16
G
16
Posts: 2,222
Reputation: 16,564

Post » Sun Mar 17, 2013 8:34 pm

@Whiteclaws, I still haven't solved my dilemma. The positioning of the body parts is not as easy as I thought it would be. On the slower computers the body parts are spread far apart.

However, I am also a confused about MaxArrayW you are effectively adding to the size every 0.01 of second. Would that array just get bigger and bigger? I am having trouble following the logic.
B
31
S
8
G
5
Posts: 436
Reputation: 5,836

Post » Sun Mar 17, 2013 8:52 pm

Okay , I'm solving it for you today , sorry if I forgot you , I'm currently making a procedural dungeon generator ... @czar , just to explain you , the tail takes the n*10 first values of the arrays and position the tail depending on them and thus the more we add data , the n*10 values change ... That makes the tail follow the player
B
34
S
16
G
16
Posts: 2,222
Reputation: 16,564

Post » Mon Mar 18, 2013 1:29 am

@czar , try this one Whiteclaws2013-03-18 01:29:16
B
34
S
16
G
16
Posts: 2,222
Reputation: 16,564

Post » Mon Mar 18, 2013 2:12 am

@Whiteclaws

Cheers thanks. Good solution.

I changed formula to 10*(fps/60) and then it works. Before you had a divide so only FPS the gap was getting larger.

B
31
S
8
G
5
Posts: 436
Reputation: 5,836

PreviousNext

Return to Completed Creations

Who is online

Users browsing this forum: No registered users and 7 guests