Sprite fire and animation

Get help using Construct 2

Post » Sat Aug 20, 2016 5:02 pm

Hi guys,

I work for android game.
I have a sprite that moves with the two arrows (right and left via touch ) and a button to shoot. that's all ok , but also having an animation that changes the character of the times when shooting ( looking right ) how do I make it clear to the program " if you look left = left shot animation and if you look right = right animation ?
B
10
Posts: 53
Reputation: 460

Post » Sat Aug 20, 2016 5:11 pm

Assuming the character is facing right, when shooting left Set Mirrored on sprite.
B
47
S
17
G
82
Posts: 2,232
Reputation: 48,611

Post » Sat Aug 20, 2016 5:12 pm

Hey there,

So you could always use the animated sprite itself, assuming you're using the "mirrored" option to flip your sprite right and left when you move in those directions.
Example:

When shooting-
--if animated sprite is mirrored = used left shoot animation
--if animated sprite is not mirrored = use right shoot animation

If this isn't what you've done, for simplicity's sake, you may want to try implementing it (there should be some tutorials that have information about animation and mirroring sprites available in the tutorials area). Otherwise you could have a variable for whether the character is facing right or not that can be set to true or false depending on whether the right or left movement buttons are pressed and use that, but unless you're moving your person in all sorts of crazy ways, that's probably overkill.
B
69
S
40
G
24
Posts: 356
Reputation: 18,314

Post » Sat Aug 20, 2016 6:06 pm

mmmh can explain me how ?

Sprite :

character (Animation : Left - Right - Fire)
bullet
fire botton
sparrow botton (for move)

How is set now :
/**CMD**/
Touch - is touching left arrow = set animation left to character AND Simulate 8 direction Left
Touch - is touching right arrow = set animation right to character AND Simulate 8 direction right
/** Fire **/
Touch - is touching fire button = set animation FIRE to character AND Spawn bullet on layer 1 ( mouth character)
B
10
Posts: 53
Reputation: 460

Post » Sat Aug 20, 2016 7:17 pm

solved with :
Image

Is ok or ?
B
10
Posts: 53
Reputation: 460

Post » Sat Aug 20, 2016 9:00 pm

That is the logic for directional shooting, for the animation you will need to set to mirrored or not mirrored based on what the controls are.
B
47
S
17
G
82
Posts: 2,232
Reputation: 48,611


Return to How do I....?

Who is online

Users browsing this forum: dop2000 and 11 guests