Bullet bouncing

For questions about using Classic.

Post » Sun Jul 21, 2013 6:32 am

so far I know how to create a bullet and when it collides with an enemy the bullet bounces but when it did, it does not follow the next closest target but instead goes straight towards the exit.

I also cannot find a way to do so.

Here are my events:
+ System: Start of layout
-> BadGuy: Set angle to random(360)


+ MouseKeyboard: On Left mouse button Either single or double clicked
-> System: Create object Bullet on layer 1 at (MouseX, MouseY)


+ Bullet: On collision between Bullet and BadGuy
+ Bullet: [negated] Bullet: Value 'hIT' Equal to 1
-> BadGuy: Spawn object Dummy on layer 1 (image point 0)
-> Dummy: Set 'LastTarget' to BadGuy.UID
-> Bullet: Destroy


+ System: For each Dummy
+ BadGuy: [negated] BadGuy: Unique ID is Dummy ('LastTarget')
+ Dummy: Pick closest to: BadGuy.X, BadGuy.Y
-> Dummy: Set angle towards BadGuy


+ System: For each Bullet
+ BadGuy: Unique ID is Bullet ('ID')
-> Dummy: Set angle towards BadGuy


+ Dummy: Value 'Produce' Equal to 0
-> Dummy: Spawn object Bullet on layer 1 (image point 0)
-> Bullet: Set 'hIT' to 1
-> Bullet: Set 'ID' to BadGuy.UID
-> Bullet: Set angle to Dummy.Angle
-> Dummy: Set 'Produce' to 1


+ Bullet: [negated] On collision between Bullet and BadGuy
-> Bullet: Set 'hIT' to 0


+ Dummy: Value 'Produce' Equal to 1
-> Dummy: Destroy


+ BadGuy: Is outside layout
-> BadGuy: Rotate 5 degrees clockwise
B
14
S
2
G
1
Posts: 46
Reputation: 1,144

Post » Thu Aug 08, 2013 4:44 am

Can you post your cap file showing this? You can usually host free with DropBox
"Construct 4 lets YOU make advanced games! (but not play them)" Construct Classic - Examples Kit
B
108
S
38
G
17
Posts: 2,172
Reputation: 18,964


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 0 guests