Pushing an object

For questions about using Classic.

Post » Tue Sep 21, 2010 9:18 am

Hi,
Because I am not experienced in Construct I cannot play a push animation when the player is pushing an object.
When this happens, a private variable 'CratePush' of the player object is set to 1. In order to play the push animation, I check if the 'CratePush' equals to 1. But I always see the first frame of the animation



What I am doing wrong?
B
2
G
2
Posts: 31
Reputation: 712

Post » Tue Sep 21, 2010 11:44 am

I believe that's because that event is telling your player to constantly play the push animation. Try adding "Trigger once" with the system object, loop the animation, and stop it when needed.
Image
B
225
S
27
G
13
Posts: 1,774
Reputation: 18,024

Post » Tue Sep 21, 2010 3:17 pm

You can get away with adding another subevent that will set 'CratePush' back to zero.
Image Image
B
161
S
48
G
90
Posts: 7,350
Reputation: 66,755

Post » Tue Sep 21, 2010 4:48 pm

[quote="Tokinsom":2qjxez4e]I believe that's because that event is telling your player to constantly play the push animation. Try adding "Trigger once" with the system object, loop the animation, and stop it when needed.[/quote:2qjxez4e]

Could you please give me an example of use the "Trigger once" event?

[quote="newt":2qjxez4e]You can get away with adding another subevent that will set 'CratePush' back to zero.[/quote:2qjxez4e]
This is done before in an "Always" event
B
2
G
2
Posts: 31
Reputation: 712

Post » Tue Sep 21, 2010 7:04 pm

[quote="pap560":cqylylwm]Could you please give me an example of use the "Trigger once" event?[/quote:cqylylwm]

+CPlayer: Value 'CratePush' Equal to 1
+Trigger once (system object condition)
-Do stuff

With that your animation will only be triggered once instead of constantly restarting and showing only the first frame.
Image
B
225
S
27
G
13
Posts: 1,774
Reputation: 18,024

Post » Tue Sep 21, 2010 8:05 pm

Thanks for the tip but It is not working. I noticed that if I will set tags in the Animator, every time I will start another animation (with tag=None) this is going to start in the first frame because it will stopped automatically by the default tag "Stopped". As a result the animation for the pushing will restart again from the first frame.
My solution: I removed all the default tags from the Animator handling all animations manually:

B
2
G
2
Posts: 31
Reputation: 712

Post » Tue Sep 21, 2010 9:11 pm

Um you don't need all those else's, and:
[quote:l5pgdsxn]This is done before in an "Always" event[/quote:l5pgdsxn]
Might be causing some issues as well.
Image Image
B
161
S
48
G
90
Posts: 7,350
Reputation: 66,755

Post » Wed Sep 22, 2010 6:21 am

[quote="newt":1412b95n]Um you don't need all those else's,...[/quote:1412b95n]
I removed the else's but my animations are not played properly.
B
2
G
2
Posts: 31
Reputation: 712

Post » Wed Sep 22, 2010 7:32 am

Ok try making your animation changes into single events.
Remember sub-events take place only after the event's condition before it are met.
Image Image
B
161
S
48
G
90
Posts: 7,350
Reputation: 66,755

Post » Wed Sep 22, 2010 1:26 pm

@newt: thanks for the tip
B
2
G
2
Posts: 31
Reputation: 712

Next

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 7 guests