Tank game

0 favourites
  • 5 posts
From the Asset Store
Everything is made via physics, Very simple code: 6 events only (3 for tank creation, 2 for controls and 1 for camera)
  • 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.


    Update, new capx:https://www.dropbox.com/s/a4i4mp70bgerd0y/111.capx

  • 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.

    <img src="smileys/smiley1.gif" border="0" align="middle" />

  • First post updated.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Here we are! Commented for extra help! <img src="smileys/smiley2.gif" border="0" align="middle">





    I hope this is OK and makes sense!

  • 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

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)