imagepoints and rapidfire

0 favourites
  • 9 posts
  • This is kinda complex so I'll be as specific as I can.

    My game is in "CONTRA" style.

    The character is divided in 3 sprites: legs, upper half, and shooting animations.

    the legs are the main part and are separated form the rest so i don't have trouble with the "firing/walking" animation.

    the upperhalf is pinned to the legs and when you aim that's the part that switches anims so it aims correctly at every direction.

    and the shooting is just the frames of the upper part while the guy shoots, also pinned to the legs. when these appear, the other upper half goes invisible, so it looks like both are the same sprite and it doesn't interfere with the aiming. When the guy is not shooting, this sprite goes to a "null" animation that has no frames in it, an invisible animation.

    We're Ok so far.

    Now I'm creating a machinegun alternate mode.

    I've made it this way:

    When "Z" key is down, the shooting sprite goes to the normal shooting. when it ends, it goes to the null anim, and if when the null anim is over the key is still down it goes again to the shooting.

    so it creates a loop that stops once you've released the key.

    the thing is working perfectly, but the problem is that the bullets are coming from the imagepoint of the NULL anim, not the SHOOTING anim. So, it is like if the bullets are being created 1 tick before it should and are interpreting the imagepoints of the previous anim. This is weird since it's set so the bullet is created once the shooting anim starts, so, there's no way the bullet is created before.

    It works fine in the first shoot of the bunch, but when it gets in the loop is where the problem starts.

    How can I solve this?

  • I don't know how you have your events and conditions set up, but I do have some questions.

    Why use the null animation instead of setting the sprite invisible?

    Have you tried the, system wait : 0, anywhere to wait 1 tick before progressing?

    Is it possible to set the imagepoint for the null animation on the spot you need for the shooting?

  • Not sure if this will help, but I have an SMG with 2 frames animated. Basically one frame for the shot, and another for recoil. SO I have my bullet scripted to spawn every time the "fire" frame is played.

    When frame(fire) plays,

    spawn bullet;

    trigger once;

    play sound;

    etc.

  • I don't know how you have your events and conditions set up, but I do have some questions.

    Why use the null animation instead of setting the sprite invisible?

    Have you tried the, system wait : 0, anywhere to wait 1 tick before progressing?

    Is it possible to set the imagepoint for the null animation on the spot you need for the shooting?

    well, I used the null anim so I can use the time of the anim as the space betewwn shoot and shoot, besides, the srpite needs an animation to fall into when not shooting.

    about the wait, I've never used it yet. I'll check how it works.

    I can set the image point in the null where I want, but that would bring this problem:

    With the shooting srpite being a separated thing, the main sprite can aim freely all the time. So, if you are aiming forward, fall into the null, and then the pleyer aim upwards, the shoot would again interpret the imagepoints of the null, shooting forward. so, it's imposible to predict where the player will aim.

    Going back to the main problem, it's really weird that what I'm doing is playing the same event over and over but once the second shoot starts that strange thing happens. I mean, it's the same event, should work exactly the same.

  • I still don't see why you'd need a null animation but ok..

    you could just check if your firing animation is playing before spawning bullets. you could even check what frame it's on and spawn bullets on a specifivc frame.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I still don't see why you'd need a null animation but ok..

    you could just check if your firing animation is playing before spawning bullets. you could even check what frame it's on and spawn bullets on a specifivc frame.

    how can I check that?

    My firing animation has only 1 frame, so, I guess that's the frame.

  • add a condition

    sprite is playing animation

  • that's set.

    bullet is only created when the sprite is in the firing animation and is triggered once.

    That's the weird part: how can it check the previous imagepoints if the bullet isn't created in that moment and only appears once the correct animation is playing?

  • OK!

    Here I uploaded the capx:

    mega.co.nz

    it's big! but that's cause the character is big, since I plan to do some serious zooming later.

    X shoots, Z jumps, and CTRL holds your position while shooting.

    pressing 1 or 2 will alternate the fire mode from rifle (1) to machine gun (2).

    the problem is when shooting on machinegun mode in rapid fire. For the moment is only implemented in the stand/idle shooting.

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