shooting

Idk what events to use to enable objects to shoot even when moving.

another problem im facing is adjusting the fire rate: when the player shoot bullets look like long lines because there is no pause

finally, i want to make the guns seem semi automatic (couple bullets shoot out then the user will have to click the mouse again to fire) can someone ell me how to do that ?

ere my project

mega.co.nz/#!GB1yWKKY!YXDSriLAc … CWvh0E20hE

key: YXDSriLAc_7KMvwM45IhP-CAPcG8b-lEKCWvh0E20hE :frowning:

Did you take a look at the tutorials that have answers for most of your questions? :slight_smile: wiki.compilgames.net/doku.php/en … rtutorial2

yh thank you i’ve adjusted the fire rate i was also able to add couple things. but im still having problems with enabling him to shoot while its walking.

i tried using 'advanced but even thats not working

Hi, me again :smiley:

I’m having trouble with shooting too. I’ve looked at the tutos but they all seem to be tanks and things shooting towards a mouse pointer. What I want to do is have my player sprite be able to shoot whilst walking, standing, jumping, etc. (using the Down key to trigger) I can get him to shoot in the directions I want him to but the associated animation doesn’t play (he just flickers) and the shots come out the top of his head in spite of me creating a point :frowning: I think my main problem is how I’m organising the events?

You can edit your previous reply instead of doing a double post :wink:

About your problem, I haven’t GD here, but i guess the animation is changed to 3 as you want, but in the next frame (0.01667 seconds later), the first conditions are fullfiled but not the spell-animation ones, so the animation is quickly changed to 0/1/2 again :slight_smile:
There are so many ways to solve it that I can’t enumerate them, you need just some logic :smiley:

  • For example, a Player’s variable “is_spelling”: The events 1-3 would be sub-events of one checking “is_spelling” = 0, then set “is_spelling” = 1 when do a spell, finally you need set “is_spelling” = 0 when animation 3 is finished.
  • Another example: For events 1-3, check that animation is different than 3 (animation != 3), and add an event (at the beginning is better) that checks if animation is 3 and has finished ==> set the animation to any other.

As said before, a lot of ways to do it :wink:

I have to remark that there are many extra events in the event 7, and you don’t just use the same actions over and over again, the repeated events are not self-cancelled :exclamation:
I mean: what happen if you press down, and keep pressed left and right? Two spells are created, maybe you want to do it, but I guess no :neutral_face:
To solve it do the basic setup for each condition first: If left or right is pressed ==> Flip Player (first because it changes the “Hand” point position. Then, in a non-condition event, the repeated actions: ==> Create object, reset timer, do animation = 3, make objects moving. Finally I see the force added is different if is in air or not, just set these two events and ready :slight_smile:

Hips! Scuses, I won’t do it again :blush: :wink:

I had tried some different ways but my logic is fuzzy sometimes and I was starting to get frustrated so I thought “There’s surely someone who knows how to do this!” :slight_smile:

I’ve taken this route, made some changes including the time between each image of the animation and it’s now working fine although it might not be the most optimized way.

The problem here was that logic tells me (and some testing confirmed it) that I can’t assign a value (force) to an object that hasn’t been created yet so some repetition seems to be unavoidable but thanks to you I’ve reduced it somewhat :slight_smile: The extra spell if someone does happen to press all 3 keys together is not an issue.

Thanks for your help :slight_smile: