Set bullet behaviour angle of motion problem

0 favourites
  • 4 posts
From the Asset Store
Complete the collection by purchasing Motion Universe Pt. 2
  • Problem Description

    In this code the set angle of motion of the bullet behaviour doesn't seem to register if called inmediately after enabling the behaviour.

    Attach a Capx

    CAPX

    Description of Capx

    The capx simulates a simple hit points indicator. The idea is that when losing HP, each heart sprite falls down using bullet behaviour at 90º.

    Steps to Reproduce Bug

    Pressing any key takes off 1 HP

    Observed Result

    Hearts move at 0º angle despite a 90º (falling down) angle being specifically set.

    Expected Result

    The sprites should move down. Strangely enough, if a minimal wait is made (toggle on the only disable action in the capx) the intended motion angle works. It seems it needs at least a frame for some reason.

    Using a way simpler example setting an angle after enabling bullet behaviour works just fine. Maybe it has to something to do with objects spawned on runtime?

    By the way, moving the set angle action to the part of the code that spawns the sprite doesn't work either, neither does putting it on an on created event for the sprite.

    Affected Browsers

    • Chrome: YES
    • FireFox: YES
    • Edge: YES

    Operating System and Service Pack

    Windows 10 60-bit 1709

    Construct 2 Version ID

    250 64 bit (Also fails on C3)

  • When speed=0, there is no motion, that's why "Set angle of motion" has no effect.

    You can wait till the object gain some speed, or add an action "Set bullet speed to 0.01" before setting angle of motion.

  • This is covered in the manual:

    [quote:2744tdhq]

    AngleOfMotion

    Get the angle the bullet is currently moving at (which can be different to the object's angle), in degrees. Note: when the speed is 0, the angle of motion is also 0. Usually this can be worked around by setting the speed before the angle of motion.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Oooh, I see, makes sense. Set speed to 1 and it works. Not a bug then, thanks guys!

    I would say it would be logical than you can set an angle even motionless at 0 speed, but can't say it's exactly wrong how it works either, I guess...

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