8 directional top down shooter? You could extend from the Ghost Shooter sample, but then you need to clarify further: how and what will set the angle of your grenade?
The how part is : in your event sheet, you can, for instance,
- if key spacebar is pressed:
- - create a grenade at player's object
- - set angle of grenade to ____ angle.
The blank above is the what part. What should be the angle of your grenade? Should we set it accordingly when the player is holding the directional arrows?
If that's the case, extending from above, you could have a global variable and some more keyboard related events like this:
Global variable grenadeAngle = 0
(Right click somewhere NOT on your events IN your event sheet and you should see an option to create a global variable)
- if key left is being holded:
- - if key up is being holded:
- - - set global variable grenadeAngle to -135.
- - else if key down is holded:
- - - set global variable grenadeAngle to 135.
- - else
- - - set global variable grenadeAngle to 180.
- else if key right is being holded:
- - if key up is being holded:
- - - set global variable grenadeAngle to -45.
- - else if key down is holded:
- - - set global variable grenadeAngle to 45.
- - else
- - - set global variable grenadeAngle to 0.
- else if key up is being holded:
- - set global variable grenadeAngle to -90.
- else if key down is being holded:
- - set global variable grenadeAngle to 90.
- if key spacebar is pressed:
- - create a grenade at player's object
- - set angle of grenade to grenadeAngle angle.
Make sure you put the spacebar event below the left right up down business. Because events from top to bottom. This will allow your grenadeAngle to reflect your recent input in this tick right away.
So what did we just do from above? We set the variable grenadeAngle to respective key inputs. If you don't understand what the heck did I just write above, you may wish to google if else statement in programming.
(If any of the term feels confusing or you need more assistance, please say so and add my name "@keroberos" in your next reply)