Problem with shooting up/down

For questions about using Classic.

Post » Wed Nov 03, 2010 9:36 pm

Hi,
i want my charackter to shoot up or down (45degree) when i press ctrl+up/down.
This works great while he is facing the right side. But if i turn him he shoots behind him self... How can i check what hes facing and then tell him to shoot to this direction + 45 degrees up/down.

B
2
G
2
Posts: 16
Reputation: 682

Post » Thu Nov 04, 2010 6:33 am

Assuming basic platform behavior, I'd do it something like so:

[code:fcer37nn]+ MouseKeyboard: On key Control pressed
-> Charakter: Spawn object Ammo on layer 1 (image point 1)
+ MouseKeyboard: Key Down arrow is down
-> Ammo: Rotate 45 degrees toward (Charakter.X, Charakter.Y + 100)
-> Ammo: Set angle to Charakter.Angle + (Charakter.Angle = 0? 45 : -45)
+ System: Else
+ MouseKeyboard: Key Up arrow is down
-> Ammo: Rotate 45 degrees toward (Charakter.X, Charakter.Y - 100)
-> Ammo: Set angle to Charakter.Angle + (Charakter.Angle = 0? -45 : 45)[/code:fcer37nn]

I used two different methods to set the angle there, but one is toggled off. The first just rotates the bullet 45 degrees toward a point above or below the character, and the second uses a conditional expression to set the angle either + or - 45 degrees from the character's angle.

Here's the simple .cap file (v0.99.96) if the above is not clear:

http://dl.dropbox.com/u/5868916/angledshot.cap

.
B
3
S
2
G
2
Posts: 187
Reputation: 1,449

Post » Thu Nov 04, 2010 10:23 am

Thanks a lot! Works great!
B
2
G
2
Posts: 16
Reputation: 682


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 3 guests