Bullet system

0 favourites
  • 10 posts
From the Asset Store
This pack contains 10 types of bullet effects, with different shapes and colors.
  • Quick one:

    How can I make a character shoot but not so fast? My char shoots, but I haven't found a control (or a way) to limit the number of bullets produced, so he just fires really fast.

    So, a facility of "Create X object after X time has passed" would be great.

    Any way to simplify? I'd prefer not to use plugins, as exploring all of Constructs abilities is my main objective.

    Thanks.

  • you have every x ms system expression, but also I'd recommend using instance variables for player (that's how I roll :)

    1) shoottimeout = interval in milliseconds

    2) readytoshootin = 0

    shoot button is pressed && readytoshootin <= 0

    -> create bullet

    -> set readytoshootin to shoottimeout

    readytoshootin > 0

    -> set readytoshootin = readytoshootin - dt

  • Thanks for the help. Got a different solution, but cheers, mate.

    Here's what I came out:

    Set a "shoot" global variable.

    At key press, if "shoot"=0, create bullet, set "shoot" to 5.

    On each tick, and if shoot >=1, take 1 from "shoot".

  • well this is preety much the same, but you didn't take into account the delta time (dt expression) which can really mess up your creation :) cheers!

  • Hi! I reopen this thread with another bullet behavior issue; I'm trying to make the bullet destroys itself whem colliding with any solid but I can't find any event similar to "on collision with a solid" or something like that. I supose it should be an easy task but I coudn't find it.

    thanks!

  • Hi Antylope,

    I think what you're after is on the "event sheet" -> event -> collisions -"on collision with another object".

    hope it helps.

    br,

    j.pinela

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • As far as I tried, the event "on collision with another object" makes you specify an object; what a I want is more global: when it collides with any object whatever it could be.

    I could add an invisible wall in front of any solid and use it as target for that event but I supose there's an easier way to do it.

    Any ideas?

  • While you're waiting for a better solution from a more experienced user, here's two solutions I can think of:

    1. Define a new family called 'SolidObject', and add all your solids to this family. Test for a collision with 'SolidObject'. The down side to this is that every time you create a new solid you need to add it to the 'SolidObject' family.

    2. This is more hack-ish, but add a Platform Movement behavior to your bullet and set all the attributes to 0, and the 'Default Controls' to no. Now Platform Movement doesn't really do much except give you a new condition to test for. In your events test for 'Is by wall' for left and for right. Use an OR to test for both sides, and destroy it in the action. The benefit of this is that you don't have to worry about classifying all your solids.

  • jajaja! It's not bad actually. I'm out of the 1st option since I cant use families (still in standard edition). I'll try the 2nd option.

    thanks

  • Instead of using families, make a layer called Collision, and make a tiny red box (like, 5x5 pixels), and spread it around where there is collision. Make THIS object solid. Check for collision against this object only. Make sure to make this layer invisible, though (or probably toggle-able, if you want to have a 'debug' area).

    This is probably something you should end up doing normally, because it removes ambiguity in collision detection.

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