0 Favourites

Gun reloading and clip size

  • So anyways, I just got my free copy of Construct 2. And I plan to use it on a top down shooter game.

    Here's the problem:

    I can't figure out how to create a limit on the bullets and limit the number of bullets that come out of the gun.

    Another extra Problem:

    I can't figure out why my health bar doesn't show up, even when the code is right. maybe I'll just replace it with a CoD like health meter (Edges on the screen start going red).

    Please help !

    Thanks

  • Limiting ammunition is done with variables. For example, you could create a local variable attached to the player called Ammo. Every time the player presses the button to fire their gun, first you check if Ammo > 0, then if it is, create an instance of the bullet along with the firing animations (or whatever else is needed) and subtract 1 from Ammo.

    If your code is right with your health bar, then it's probably something silly like a layer or object set to invisible. If you can't come right on your own then you should post a link to your capx so we can take a look for you.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Thanks! I'll try it out now

    For the health bar, it was a layer problem. Guess i need to be careful next time :)

  • I really keep on hitting roadbumps.

    Anyways, i put a text which shows the variable AMMOPISTOL. It shows ammo properly while firing, but when I try to reload, what happens is after reloading, if you keep on shooting the bullets come out but the ammo doesn't change.

    Maybe because my pc is slow? anyways please help!

    Anyways, here is the link!

    Exported version : dropbox.com/sh/rpltwhugxh582mk/d-XN22NDSw

    Project Files :https://www.dropbox.com/sh/cvk5i458jg8bfl7/zJfpskkZKZ

  • That "every 2.5 seconds" at event 15 is weird, and seems to be causing the issue. Disable that and replace it with system->trigger once while true. Also set event 14 to trigger once.

  • Blushot You are going to keep running into issues that seem like roadblocks until you get used to the tools. I highly advise going over the manual (judging by the number of badges under your name I would say you haven't) and also going through many of the tutorials. Also Construct ships with many sample projects. Open them up and check the event sheets for a lot of good info on how things work.

    Glad to have you in the community, it has a bit of a learning curve, but is a great set of tools.

  • Thanks for the replies. Looks like i need a lot of learning and editing to do :)

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