[SOLVED] Increase bullet speed by X pixels pr object overlap

  • I hope I'm just being stupid here..

    Got stuck on what i hope is a simple problem..

    What I want is:

    Player overlaps selected Sprite = Player speed (bullet) increases by 5 pixels.

    It should gain an other 5 pixels in speed on the next overlap, and so on.

    Currently the closest thing to this I can think up is to have a variable check on overlaps and set speeds to

      * variable=1"overlap"`=Player set bullet speed 100 * variable=2"overlap"`=Player set speed 105 * variable=3"overlap"`=Player set speed 110 * variable=3"overlap"`=Player set speed 115

    But there has to be a simpler way since we're talking a Whooooole lot of overlaps..

    Acceleration increases speed ofc, but it keeps accelerating after the overlap as well, which breaks things.

    Feel free to dummy it down a bit if you have an advanced answer.

    I have no idea what I'm doing usually.

    Your's truly, Miss Insomnia..

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • on overlapping with player

    Action: set speed to Object.bullet.speed+5

  • Not sure how efficient this is, especially for lots of objects, but what about this:

    Explanation: If it is overlapping an object, count how many there are. Then add the count of objects to the speed.

    @volkiller730 wouldn't that accumulate speed without decreasing it?

    Edit: Oh you mean it doesn't decrease? Sorry I misunderstood.

  • on overlapping with player

    Action: set speed to Object.bullet.speed+5

    This works absolutely perfectly

    This is the last piece in the puzzle and the game is almost done now

    Thank you!!! <3

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