Set Animation Frame Revisited Capx Attached [C2] [SOLVED]

Just started using Construct 2? Post your questions here

Post » Tue Jul 18, 2017 8:24 pm

I'm not clear what the issue is. In the initial capx you wanted to create multiple sprites and have each one have a different frame. The solutions you got so far seem to correct that.

Your Larger capx just creates four different sprites. I can't tell from your descriptions how you want it to want it to work. and in what way the result not correct.
B
92
S
32
G
109
Posts: 5,290
Reputation: 70,991


Post » Tue Jul 18, 2017 8:31 pm

R0J0hound wrote:I'm not clear what the issue is. In the initial capx you wanted to create multiple sprites and have each one have a different frame. The solutions you got so far seem to correct that.

Your Larger capx just creates four different sprites. I can't tell from your descriptions how you want it to want it to work. and in what way the result not correct.


Oh, hi, ROJO.

Yeah, I threw a lot in there, but that's all easily programmable by me.

Basically, in the larger capx I posted, the only difference is the spawned ships do not have static positions, but variable horizontal positions based on an array which picks some random non-repeating values out of a larger array and sorts them in ascending order and THERE the engine wash does not alternate. I just want it to alternate and I need the 4 frames. So no idea why that's happening. It only works sporadically right now, so gotta hit the F5 key a few times to reload to see it.

So basically I need:

spawned ship 1 starts at frame 0

spawned ship 2 starts at frame 1

spawned ship 3 starts at frame 2

spawned ship 4 starts at frame 3

spawned ship 5 starts at frame 0 (need to change the random values in there to 5 to see that)

spawned ship 6 starts at frame 1

etc etc depending on spawn size

---
and maybe an alternate version if this proves complex

so

spawned ship 1 starts at frame 1

spawned ship 2 starts at frame 2

etc etc
B
36
S
20
G
18
Posts: 244
Reputation: 12,863

Post » Tue Jul 18, 2017 8:58 pm

Ok, now I can at least somewhat understand your events. The issue is event 44. To fix change it's condition to "else".

what happens in that function is:
if var != 4 then add 1 to var
if var == 4 then set var to 0

So if the var is 3 going into the function it will first change to 4 and then set to zero right after.

The whole event sheet is kind of stretched out. You could simplify it to around 10 events i'd think.

Edit:
You're also messing with that frame variable at the end of the "Spawn_Ec_Ships" function. That probably also will cause the same kind of problem.
Last edited by R0J0hound on Tue Jul 18, 2017 9:16 pm, edited 1 time in total.
B
92
S
32
G
109
Posts: 5,290
Reputation: 70,991

Post » Tue Jul 18, 2017 9:16 pm

Yup, the Else fixed it for the 4 spawn (think i hit reload 15 times to test), but not for the 10 max spawn version or 7 for that matter (probably values larger than 4 for the spawned ships).

http://www.darksunpictures.com/public/LARGERCAPX2.zip
B
36
S
20
G
18
Posts: 244
Reputation: 12,863

Post » Tue Jul 18, 2017 10:04 pm

All the functions and globals made it hard for me to follow what the events do. Here's a simplified version that's a lot more readable to me:
https://www.dropbox.com/s/tdcv8lil8p14f ... .capx?dl=1

Maybe that's helpful. Yours may just have one or more simple typos somewhere.
B
92
S
32
G
109
Posts: 5,290
Reputation: 70,991

Post » Tue Jul 18, 2017 11:31 pm

Thank you, ROJO.

You are the master, as always.

That is a very neat way of programming.

I haven't seen it before.

Nice!!!

Thanks again.
B
36
S
20
G
18
Posts: 244
Reputation: 12,863

Post » Thu Jul 20, 2017 12:39 am

So for frame 1 cycling, frame=1?
Last edited by AmpedRobot on Thu Jul 20, 2017 2:15 am, edited 2 times in total.
B
36
S
20
G
18
Posts: 244
Reputation: 12,863

Post » Thu Jul 20, 2017 1:49 am

You could just set the initial value of the frame variable to 1. Unless I'm misunderstanding what you're saying.
B
92
S
32
G
109
Posts: 5,290
Reputation: 70,991


Previous

Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 1 guest