How do I make a bullet sprite spin as its moving?

Get help using Construct 2

Post » Sun Mar 23, 2014 9:05 pm

I'm struggling with this so perhaps its easier if I just ask:

I have a character throwing an axe. The axe has the 'bullet' behavior. It works fine. However, I would like the axe to 'appear' like it is spinning as it is moving/following the path of the bullet behavior. Is there an easy way to do this?

The way I have done it successfully is I create an animated .gif with another program... and I basically create an animated gif of the axe picture spinning around (the animated gif was created basically by sitting there are rotating the axe picture about 10 times and then the 10 pictures are played in order making it look like the axe is spinning)... and then in Construct 2, I tell it to play the animated gif of it spinning while it is moving..... but I'm hoping I don't have to create animated gifs everytime I want to make a spinning effect.

Is there an easy way to create this spinning picture effect this inside construct 2 without having to use animated gifs/animations? Thanks in advance.
B
9
S
2
Posts: 111
Reputation: 1,010

Post » Sun Mar 23, 2014 9:35 pm

Apply the rotate behavior to your sprite
B
47
S
16
G
9
Posts: 1,097
Reputation: 11,180

Post » Sun Mar 23, 2014 9:42 pm

Doh! My bad... I should have explained better.. The thing is... I have the axe going 'towards' another object... so once I apply the rotate behavior, the axe no longer follows the same path. Hopefully that makes sense in the way I explained it.. that is why I've used animated gifs...

Is there some way to apply an 'effect' to make it 'appear' like is rotating? I tried fiddling with the 'sine' behavior but that didn't do it... and once I start using the 'rotate' behavior, I notice that my axe no longer is going towards another object like I want.
B
9
S
2
Posts: 111
Reputation: 1,010

Post » Sun Mar 23, 2014 11:49 pm

why not create a 'dummy' sprite with bullet behavior.then place your real sprite on top of it
every tick place real sprite on dummy and give your real one whatever angle or behavior you want. this way bullet will not interfere with rotate
B
15
S
6
G
4
Posts: 277
Reputation: 3,948

Post » Mon Mar 24, 2014 12:03 am

Rotate on the Axe, in Bullet Behaviour, disabled set angle. If you have Set Angle on, when the Axe rotates it changes the bullet direction. If its disabled, the bullet movement will fly straight while the sprite is rotating.
B
70
S
24
G
19
Posts: 1,757
Reputation: 17,614

Post » Mon Mar 24, 2014 12:38 am

Yes Set Angle in the bullet behavior should be set to off. The only downside is there is no way in code (that I know) to turn that back on. So if you ever want your bullet behavior to go in a different direction (and it has a front/back) you will need to set both: Bullet.SetAngle and Bullet.SetAngleofMotion
B
97
S
31
G
15
Posts: 1,182
Reputation: 16,046

Post » Mon Mar 24, 2014 8:05 am

Late to the party :( Here is something I was playing around with that you might , or might not, find useful ?
You do not have the required permissions to view the files attached to this post.
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
33
G
47
Posts: 1,194
Reputation: 30,832

Post » Tue Mar 25, 2014 3:10 am

Sorry guys... I'm still confused. The ONLY way I could figure out how to get the axe to be shot towards a moving target is:


In the bullet properties, I MUST do the following:

Set Angle = YES

In the Event Worksheet, I MUST do the following:

System - Every Tick - sprite1 - set angle toward (sprite2.x,sprite2.y)

PS: Sprite 1 = is the axe picture & Sprite 2 = a picture that I want the axe to hit which is moving.

The above is the ONLY way I could figure out how to get the axe to be shot towards a moving target... but I still CANNOT figure out how to get the axe to spin around while it is being shot. I even tried:

System - Every Tick - Sprite1 - Rotate 5 degrees


Any ideas? Sorry... I'm a novice and am really struggling trying to understand this mumbo jumbo but your efforts are GREATLY appreciated. :)





Unless I do this, the axe will not shoot towards another object
B
9
S
2
Posts: 111
Reputation: 1,010

Post » Tue Mar 25, 2014 8:06 am

If your axe is spinning then it only needs to point left or right (ie mirrored) depending on if the angle is between (90 and 270) - it would also need the spin to go clockwise (to the right) or anticlockwise (to the left) ?

test 2 - click mouse to make a random direction axe
You do not have the required permissions to view the files attached to this post.
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
33
G
47
Posts: 1,194
Reputation: 30,832

Post » Tue Mar 25, 2014 9:09 am

Last one from me - added bounce to the axe.
You do not have the required permissions to view the files attached to this post.
August 2015 - I misplaced a lot of links - I will try to find backups and repost. If You find a post that interests please reply to post with @rampackwobble and I will get a nudge!

If you find my posts useful please consider donating something to a local charity or to the http://www.mndassociation.org/
B
64
S
33
G
47
Posts: 1,194
Reputation: 30,832

Next

Return to How do I....?

Who is online

Users browsing this forum: Rhindon, YoHoho and 23 guests