Cannot set Bullet "angle of motion" to go up or down

0 favourites
  • 4 posts
From the Asset Store
The ultimate voice pack filled with 1,536 files of .......wav and mp3 of individual numbers, letters, and words (that go
  • Problem Description

    I Cannot set Bullet "angle of motion" to go up or down, even if I set the Bullet speed first. It can only go left and right.

    I ensured that Bullet > Set angle is set to No, but it persists.

    Attach a Capx

    DEMO: http://naturedumarche.com/block/export/index.html

    CAPX: http://naturedumarche.com/block/bulletangleofmotionproblem.capx

    Description of Capx

    Use WASD and see what happens when pressing A or D; it seems like there is no way I can make the character go up or down using the Bullet behavior. I tried a lot of combinations, I think this is an engine problem (and a basic one, I put as much time trying to fix this than to make the whole project, this is frustrating). I was on an older version so I thought it was maybe normal, so I updated (to v.216), but the exact same problem is still there.

    Affected Browsers

    • Chrome: (YES)
    • FireFox: (YES)
    • Internet Explorer: (YES)

    Operating System and Service Pack

    Windows 7 64-bit SP1

    Rendering with OpenGL 4.5.0 nVidia 347.52

    Construct 2 Version ID

    Release 216 (64-bit)

    Built at 13:46:39 on Oct 22 2015

  • I'm not the dev but here's a quick explanation of what is happening. The behavior doesn't store the angle of motion and speed, instead it stores the horizontal and vertical velocities and calculates speed and angle of motion from them. So when the speed is 0 the velocities are (0, 0) which results in an angle of motion calculated as:

    angleOfMotion = angle(0,0, horizontalVelocity, verticalVelocity) = angle(0,0,0,0) = 0

    That's why whenever the speed is 0 the angle of motion becomes 0. which happens in your capx when you set the speed to iaccelerate, which is zero at the start of the layout and after hitting a wall.

    Anyway's while waiting for an official response you could reproduce the bullet behavior with events. It's rather simple and we can make it keep the angle of motion even when the speed is zero.

    1. add two variables to your object of choice (character for instance), and call them "speed" and "angleOfMotion".

    2. add an event like the following and put it toward the top of your event sheet. basically jut use the "move at angle" action.

    every tick
    --- character: move self.speed*dt pixels at self.angleOfMotion degrees[/code:zts93hcr]
    
    And that's pretty much it.
  • Closing, please follow the bug report guidelines and submit a minimal .capx only.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you very much R0J0hound, I followed your guidelines and it works now. I set and reset the Bullet speed to 1 instead of 0 and it now works I don't need to re-open the bug report.

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