Change Animation Frame Expression Error

Get help using Construct 2

Post » Tue Jan 28, 2014 6:49 pm

Hey Construct Community,

I felt particularly clever when I created an Ammo HUD indicator like the one seen in Halo: Combat Evolved. I used the expression "AmmoIcon.AnimationFrame+1" to change the animation, and it works perfectly with the pistol. If you equip the machine gun, however, it stops working.

Any ideas?

https://www.dropbox.com/s/iawsrxravx3840l/updatedzombie.capx

Thanks.
B
22
S
4
G
1
Posts: 153
Reputation: 1,938

Post » Tue Jan 28, 2014 7:09 pm

event 39 needs ammoicon animationframe=xx

similar to event 36 ?

Edit - ok after trying this it is a slight improvement, but it leads to other problems. Things I think you should consider

instead of checking to see if a certain animation is playing I think you would be better giving your player an instance variable (ivGunInUse ?) and set this to glock/ak47 and use this rather than animation running.

Let us know how you get on ?RamPackWobble2014-01-28 19:22:34
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
34
G
47
Posts: 1,194
Reputation: 30,882

Post » Tue Jan 28, 2014 7:19 pm

That's for the reload animation to play. But it isn't even changing the value to get to the point where I need to reload.
B
22
S
4
G
1
Posts: 153
Reputation: 1,938

Post » Tue Jan 28, 2014 7:24 pm

I guess you changed it to about 31 ? Try 11 (I know this isn't right - but give it a go and see what happens) ?
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
34
G
47
Posts: 1,194
Reputation: 30,882

Post » Tue Jan 28, 2014 7:25 pm

I think I figured it out. .AnimationFrame applies to the current animation, not all animations.
B
22
S
4
G
1
Posts: 153
Reputation: 1,938

Post » Tue Jan 28, 2014 9:36 pm

Nevermind, still stuck. I tried making 2 different types of bullets, 2 separate ammo sprites, and 2 separate Boolean instance variables and none worked.
B
22
S
4
G
1
Posts: 153
Reputation: 1,938

Post » Tue Jan 28, 2014 11:33 pm

Hi! Please try this @awmace5 : https://www.dropbox.com/s/gggzsmx7i9ycv7s/updatedzombie2.capx

-----

Changes:

Instance Variables in AmmoIcon

Added Actions to "Player on Collision with AK47"

Added Subevents in event "On Z pressed" and some conditions were disabled (delete them)

Added Subevents in event "On X pressed" and some conditions were disabled (delete them)

Added Actions to event "On animation "PistolReload" finished"

Adjusted event "Is animation "AK47" playing" so that the weapon reverts to pistol when AK47 runs out of ammo.

Added Subevents in event "Bullet on created" so that everytime a bullet is generated, the current weapon clip is saved. This is helpful when changing between weapons so that you can get the correct remaining ammo for each everytime.

-----

Good-Luck! :)REDVWIN2014-01-29 00:03:35
B
18
S
4
G
1
Posts: 25
Reputation: 1,779

Post » Tue Jan 28, 2014 11:38 pm

I have also had problems with this. On what platform do you get this error?
It works fine on HTML 5, but when it is exported to Android or iOS I have the same issue.

The way I fixed the problem was deleting all the other animations and only having one animation, but if that is no good for you, you could try using the pin behavior?
B
16
S
4
Posts: 69
Reputation: 1,834

Post » Wed Jan 29, 2014 12:13 am

@REDVWIN I downloaded the file, but it says you are using release 159, and I have release 158.2. How do I update, or are you using beta updates?

@federer365 I got this error on the HTML5 platform testing on Google Chrome.
If you deleted all the other animations, how did you get the bullets to disappear as you shot the gun?
B
22
S
4
G
1
Posts: 153
Reputation: 1,938

Post » Wed Jan 29, 2014 2:08 am

[QUOTE=awmace5] @REDVWIN I downloaded the file, but it says you are using release 159, and I have release 158.2. How do I update, or are you using beta updates?

@federer365 I got this error on the HTML5 platform testing on Google Chrome.
If you deleted all the other animations, how did you get the bullets to disappear as you shot the gun?[/QUOTE]

Please try this other link: https://www.dropbox.com/s/qfdw8iwn44idesb/updatedzombie2r15802.capx

As for the Beta Release: https://www.scirra.com/construct2/releases/r159

B
18
S
4
G
1
Posts: 25
Reputation: 1,779

Next

Return to How do I....?

Who is online

Users browsing this forum: Baidu [Spider], divsyntax, Google [Bot], pmerineau and 10 guests