Tank game

Get help using Construct 2

Post » Wed May 30, 2012 9:07 am

Im creating my own version of old Battle City (tank game).

I have runned in some problems.

First of all, I would like that the blocks would destroy on 3'rd hit, not first, or the more difficult version of block getting smaller every hit form the direction where it's been hit. I tried scale mode, but that wount work right.

Another question is that tank can only shoot 1 bullet at once, that you can shoot another one when the old one is destroyed.

Last thing is about enemy tanks, how to put them randomly moving and oriented on your tank and your "eagle" what you have to protect.




Thanks

Update, new capx:https://www.dropbox.com/s/a4i4mp70bgerd0y/111.capxAjudoonor2012-05-30 12:53:24
B
3
Posts: 7
Reputation: 364

Post » Wed May 30, 2012 10:25 am

If you create a variable for the objects that can be destroyed you can use is to calculate the 3rd hit. You could make an event such as the collision and add a sub event first to check that the Variable ( lets say hitcount) equals 3. If so, destroy itself. Add another subevent to the collision and check to see if hitcount is less than three. If so, add 1 to hitcount. In fact, make it so it doesn't check that hitcount is equal to 3 instead make it check that it is equal to or greater than 3 (or greater than 2). That way if there is an error and for some reason hitcount is 4 it doesn't cause any problems. The variables would also be ones attached to the objects opposed to a global variable.

For creating one bullet at a time create a global variable called say bulletExists. When creating the bullet, test as wellt that bulletExists equals false or 0. If it is, create the bullet and setting to True or 1. If not, don't make the bullet.
When the bullet is destroyed, in the same event add An action that changes the bulletExists back to false or 0.

In fact, there might already be a system variable you could use. Perhaps instance count? If that equals 0 shoot, else don't. That sort of thing. Maybe.

I'll upload a capx when I can. :)

Note: you have uploaded a caproj there. You need to upload a capx.

DalekAddison2012-05-30 10:28:15
B
29
S
4
Posts: 42
Reputation: 2,391

Post » Wed May 30, 2012 12:57 pm

First post updated.
B
3
Posts: 7
Reputation: 364

Post » Wed May 30, 2012 2:58 pm

Here we are! Commented for extra help!


Demo:
https://dl.dropbox.com/u/46716511/TankControl/index.html

CAPX:
https://dl.dropbox.com/u/46716511/TankControl/TankBulletandBlock.capx

I hope this is OK and makes sense!
B
29
S
4
Posts: 42
Reputation: 2,391

Post » Thu May 31, 2012 2:28 pm

Thanks for help, got the "hitcount" working, but had problems with 1 bullet at same time.

Still need help with random movement enemy tanks and 1 bullet at a time.

I would really appreciate if you decide to help and change/update the same file that I have putted here.

File: https://www.dropbox.com/s/bdx47f28sv9knyw/1111.capx

Thank you
B
3
Posts: 7
Reputation: 364


Return to How do I....?

Who is online

Users browsing this forum: flemmig, Kagubro, MisterAqua and 24 guests