Moving 8-direction into specific angle?

Get help using Construct 2

Post » Sun Oct 19, 2014 2:46 am

How can I make a sprite that's controlled by 8-directional behavior to move into a specific angle on the screen? Is there some kind of system for this in the behavior or do I need to use another behavior just for this? My enemy objects move normally in eight directions but I'm going to need this for certain actions, such as flying away from an explosion into random directions.
B
21
S
7
G
4
Posts: 233
Reputation: 3,474

Post » Sun Oct 19, 2014 3:32 am

Its generally easier to only use 8-direction for player controlled object and use bullet behavior for enemy units setting the angle and speed, etc. within a bullet behavior event.
Check out my completed games on the Arcade! Capt. Doe Save the Universe! & Clicker Wizard!
B
69
S
18
G
8
Posts: 639
Reputation: 9,549

Post » Sun Oct 19, 2014 3:47 am

I thought about that, but I've done too much stuff on the enemy AI to be ditching the 8-direction behavior now. I'll try disabling the 8-direction and enabling bullet behavior when the enemies fly away and then reverting them.
B
21
S
7
G
4
Posts: 233
Reputation: 3,474

Post » Sun Oct 19, 2014 7:11 am

Message: grigrizljac can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
Try to do something like in this tutrorial: https://www.scirra.com/tutorials/398/to ... ntrollers/
It is for JoyStick, but you can move into any direction.
B
32
S
7
G
4
Posts: 398
Reputation: 4,591

Post » Sun Oct 19, 2014 7:58 am

You could use int(random(360)) degree to move them away
B
255
S
39
G
15
Posts: 1,982
Reputation: 41,005

Post » Sun Oct 19, 2014 2:03 pm

grigrizljac wrote:Try to do something like in this tutrorial: https://www.scirra.com/tutorials/398/to ... ntrollers/
It is for JoyStick, but you can move into any direction.


You can't seem to post urls yet.

Lordshiva1948 wrote:You could use int(random(360)) degree to move them away


That's pretty much what I did. Disabled 8-direction, enabled bullet, set randomized angle and reverted the behaviors when the flight animation is over.
B
21
S
7
G
4
Posts: 233
Reputation: 3,474

Post » Sun Oct 19, 2014 2:15 pm

Hasuak good for you thanks
B
255
S
39
G
15
Posts: 1,982
Reputation: 41,005


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 6 guests