Change Animation Frame Expression Error

  • 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?

    dropbox.com/s/iawsrxravx3840l/updatedzombie.capx

    Thanks.

  • 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 ?

  • 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.

  • 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) ?

  • I think I figured it out. .AnimationFrame applies to the current animation, not all animations.

  • Nevermind, still stuck. I tried making 2 different types of bullets, 2 separate ammo sprites, and 2 separate Boolean instance variables and none worked.

  • Hi! Please try this awmace5 : 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! :)

  • 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?

  • 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?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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?

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

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

    <img src="smileys/smiley2.gif" border="0" align="middle" />

  • Works great, thank you very much!

  • Yeah! Hope you progress fine with your zombie game. Time to update your DevBlog! crusadersoftware.com/devblog.html ;)

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)