set Bullet angle for Y Axis?

0 favourites
  • 8 posts
From the Asset Store
This pack contains 10 types of bullet effects, with different shapes and colors.
  • Hello, I have a problem. I want create FPS and i dont know how set bullet angle for Y axis?

    thank for help :)

    Tagged:

  • Hello, I have a problem. I want create FPS and i dont know how set bullet angle for Y axis?

    thank for help :)

    This looks very awesome mate keep it up!

    For your issue, try to manipulate the z elevation of the bullet, so if you want it to fly forward it has to substract 1 from z elevation each tick or whatever speed the bullet is going.

    Quick example is creating a variable called bulletZ, add every tick set bullet sprite z elevation to bulletZ

    and then after that i would add like "every 0.2 sec > substract 1 from bulletZ".

    This would make the bullet appear flying forward.

    Then you will ofc have to implement your way of firing the bullet i just gave you an example that i think would work. Like add a function to shoot the bullet, check z elevation to destroy the bullet once its like -100 z ele

    Let me know how it works out, again, seems like a nice game :)

    P.S: If you worked with 3d shapes before, z elevation is way easier to understand.

  • A bullet flying forward in this way wouldn't actually be in the game world so there would be no way to know when it is hitting a wall. So the calculations you would make to detect when it does hit something require you to come up with a formula that could have made the original bullet fly legitimately in the game world without faking it 2-d so none of this makes any sense.

    Your suggestion sounds like you haven't even tried the 3d camera very much otherwise your advice might contain the world ZScale in it, as somebody calculating angle would need to convert it to pixel in the first place to have a chance at all of working.

    The code I have in my example works fine just not at extreme angles the original poster here would probably be better off following the example in my question on this same subject than this advice.

  • From my experience the suggestion of Sami424 is actually correct.

    1Z elevation is 17.4px. So if you wannt to raise the bullet 1px/tick you set the z elevation to self.zelevation+1/17.4 also you should take deltatime into account... you can then check the zhigh of an object against the zheight of the bullet and determine if they collide or not at a given point. How fast the bullet raises or falls is determined by the angle, but i have no idea how to calculate that, let me know if you can figure it out :D i would do some trial and error... but must be quite complicated. shooting straight is no problem tho.

    But as you are making a shooter, have you come up with an idea how to determine sound positions? this is quite important for an fps but with the current system C3 has for audio pos its very hard to do...

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • A bullet flying forward in this way wouldn't actually be in the game world so there would be no way to know when it is hitting a wall. So the calculations you would make to detect when it does hit something require you to come up with a formula that could have made the original bullet fly legitimately in the game world without faking it 2-d so none of this makes any sense.

    Your suggestion sounds like you haven't even tried the 3d camera very much otherwise your advice might contain the world ZScale in it, as somebody calculating angle would need to convert it to pixel in the first place to have a chance at all of working.

    The code I have in my example works fine just not at extreme angles the original poster here would probably be better off following the example in my question on this same subject than this advice.

    zScale scales the bullet forward/backwards.

    I have experience in this, unfortunately since construct 3 is a 2d engine from start, we dont have many options for making 3d objects move in that angle.

  • From my experience the suggestion of Sami424 is actually correct.

    1Z elevation is 17.4px. So if you wannt to raise the bullet 1px/tick you set the z elevation to self.zelevation+1/17.4 also you should take deltatime into account... you can then check the zhigh of an object against the zheight of the bullet and determine if they collide or not at a given point. How fast the bullet raises or falls is determined by the angle, but i have no idea how to calculate that, let me know if you can figure it out :D i would do some trial and error... but must be quite complicated. shooting straight is no problem tho.

    But as you are making a shooter, have you come up with an idea how to determine sound positions? this is quite important for an fps but with the current system C3 has for audio pos its very hard to do...

    1z elevation is not 17.4, it is different for every viewport size, that is what the Zscale function was made for. Also Construct 3 has a "play audio at position" action in the basic events for Audio.

    The reason that shooting straight in first person view using the 3d camera is not as easy as your thinking is because the Zevevation per tick creates a velocity that has to be subtracted from the speed because bullet speed behavior = X/Y ONLY and a bullet shooting almost straight up isn't going anywhere so far as bullet.speed or X/Y position wise.

  • The basic audio possitioning does not work for fps (speaking of first person shooter) as it does not take the looking angle of the player into account. so it works only if he looks "up" on the layout.

    for bulluts flying straight its really easy to do, you just set the z elevation of the bullet and laet it fly with the bullet behavior using normal x - y. like this i think: gyazo.com/5cf5926ead353947bcff2b45160a64bd OR you mean something else and i dont get it, in this case i am sorry. The more difficult thing to do is letting the bullet fly "up and down" on z taking the player looking angle into account...

    Edit:

    Had to read again, sorry, you mean straight up, not straight from an fps view...

    jea idk, i havent tested this yet. sory, i thought you meant shooting straight from an fps view... from his point of view to the enemy...

    I might try this...

    Edit2:

    gyazo.com/c745a253c312ca993fdeaf1fb43eb65f

    now the bullets fly up also, isnt that what the op wants?

    Set ZElevation to Self.ZElevation+1/3DCamera.ZScale

    if you have an idea for the audio positioning i gladly take it into account, here i describe the problem: construct.net/en/forum/construct-3/how-do-i-8/rotate-audio-relative-166583

  • I would think the angle the player is facing would be highly involved in playing audio from location!

    If your right then I think you are going to have to make your own sound handling events, The 8 direction sprite example should help you because it has angle vs angle math and the word MODULO is what your looking for.

    Also there is a lot of discussion going on with getting the 3-d shot to fly straight, It seems to be a little more to it than meets the eye, starting with the word...Zscale and ending with the phrase shared velocity.

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