Tank Turret movement w/ mouse or keyboard?

Get help using Construct 2

Post » Tue Nov 27, 2012 7:32 pm

My tank is always facing right in my game. I only need a turn radiousof 3 positions on either side of center. How do I turn the turret but not the tank? Should I use mouse or keyboard for movement since it will only turn a few degrees.
B
31
S
16
G
11
Posts: 450
Reputation: 9,721

Post » Tue Nov 27, 2012 9:05 pm

- Every Tick
-> Set Turret Angle towards Mouse.X Mouse.Y

- Turret.Angle > 35
- Turret.Angle <= 180
-> Set Turret.Angle 35

- Turret.Angle < 325
- Turret.Angle > 181
-> Set Turret.Angle 325

You can change the 35 and 325 degrees to different numbers for more/less of a turret sight.
B
40
S
12
G
7
Posts: 603
Reputation: 7,656

Post » Tue Nov 27, 2012 9:15 pm

Try this, I made for try, move turret with mouse and shoot with left mouse botton
http://www.williamjcrow.altervista.org/file/tank.capx    
B
6
Posts: 6
Reputation: 590

Post » Wed Nov 28, 2012 12:06 am

Thanks for the replies.
Sorry for the newb question but do I need to make the turret a seperate sprite from the tank? Also, how do I accomplish that?
Again, thanks for any help. This is actually my first attempt at game making, except for the 2 beginner game tutorials.
B
31
S
16
G
11
Posts: 450
Reputation: 9,721

Post » Wed Nov 28, 2012 6:23 am

Well I'm newbie too, and I do just some tutorial and I still read manual, but I don't have lot of time, anyway, sure if U made 2 different piecesit's better and he take just a few line of blocks, follow my file, use COW lines and I think it going good :D
B
6
Posts: 6
Reputation: 590

Post » Wed Nov 28, 2012 8:39 am

I finally got the turret to stay on the tank and to move along with it. (Yeah for me!) The turret is shooting and the bomb follows the angle of the turret.

BUT! If I mouse click in quick sucession each bomb will follow the angle of the turret. It looks kinda cool actually. Like they're dancing. But yes, that is not what I want.

So, how do i get the bombs to follow thier own path after they are created and not diverted by the new angle of the turret.

Also, my tank drives off screen and I have bound to layout.

Almost done, How do I get the bomb to bounce off the edge of the layout, like pong or breakout? It will explode after it hits either the enemy base or the enemy tank?

And again, thanks for all the help.
B
31
S
16
G
11
Posts: 450
Reputation: 9,721


Return to How do I....?

Who is online

Users browsing this forum: Unconnected and 28 guests