Help with bullets please?
I need help getting my guy to fire bullets in all directions. I have looked at the shoot um up template and all i can do is get them to fire right.
What i want is for them to fire left "when my guy looks left" and "right when he looks" right
What i want is for them to fire left "when my guy looks left" and "right when he looks" right
Comments
I assume you have rules like this:
When <- is down, move left.
When -> is down, move right.
What you need to do is add a self.attribute that is left or right:
1 = facing right
0 = facing left
Then set it so that:
When <- is down, move left, and set self.attribute to 0.
When -> is down, move right, and set self.attribute to 1.
Then, when space is down:
If self.attribute = 0, spawn bullet at (whatever x and y position) direction 180.
If self.attribute = 1, spawn bullet at (whatever x and y position) direction 0.