Expressions/Events For Radial Recoil

From the Asset Store
14 amazing sound files of game events like Level Ups, Level Completes, object spawn, object taking etc.
  • I've implemented a radial aiming system for the platform behaviour with some weapon recoil using the method outlined in dop2000's excellent tutorial (thank you!). I've adapted this to a gamepad, and it's working well using the following events: -

    However, I'd like to add some radial recoil to complement this, and I think I can use the same method, but I'm struggling with how to adapt the expressions to fit this radial movement instead of the single opposite angle that the gun is firing. Could anyone suggest how I might do this?

    The end result would be something like this (i've roughly simulated the movement manually to show this - the quality of the gif makes it a little hard to see, but the gun kicks both backwards and radially around the aiming arc of the player, and then resets to default position): -

  • Is the gun always pointing horizontally (not rotating to mouse position)? Then you can simply do this:

    Aim set angle to (-recoil)

    Or when the sprite is mirrored:

    Aim set angle to (180+recoil)

  • The gun can rotate to any angle - it’s pretty much the same as your example, but mapped to an analogue stick, so it would recoil based on its relative position. Here’s another quick gif showing the current implementation: -

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Amazing, thank you so much, and also for the original tutorial; it's a great method!

  • I've implemented my own version adapted from the mouse control, but I'm running into some strange behaviour which might be related to gamepad controls and lack of a mouse cursor to reorient the radial position to. The radial motion is funtionally working, but I'm not exactly sure what is causing the issue (it's possible the analogue position resetting to 0 if the player shoots and lets off the stick?).

    I've attached the project file if anyone with a gamepad could have a look - you should be able to see what the problem is compared to the effect that I'm trying to create in the first animated gif. Essentially, the example that dop2000 provided is exactly what I'm going for, but mapped to gamepad.

    https://www.dropbox.com/s/4rqw7ulf78hle2g/RecoilGamepad.c3p?dl=0

    This is a quick gif of the issue that might be helpful too: -

    Thank you for any help you can give!

  • Move "Set angle" action from event #10 to #11

  • Brilliant, that worked - thank you so much.

    Can I also ask, if I want to create a larger radial movement independent from the linear movement, would an approach be to create a second variable on the gun object (i.e. RadialRecoil) and then simply adjust the clamped value? Or is there something else that I'm missing?

  • Yes, I think so. You can create a separate value for radial recoil and use a different easing expression or maybe Tween to change it.

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