Simple Scorched Earth, Worms game

  • Hi, can someone point me to the tutorials which help me build simple Scorched Earth game? I'm planning to remake old Amiga TANX game. The controls will be simple, numbers based, (not like Worms or Angry Birds).

    I tried to find tutorial to generate random terrain in possible simplest way, but most of examples comes from inactive Dropbox accounts.

    Also I don't know how to implement script for calculate shots.

    Tanx gameplay: youtube.com/watch?v=KYtqZ2WFcIM

  • You don't need to calculate the shots, just use Bullet behavior with gravity.

    The hardest task would be removing parts of the terrain after explosions and figuring out how to move tanks on the changed terrain.

  • My favorite way to do terrain is with a tilemap. You probably want to generate the terrain with events instead of using the editor. Destroying terrain is just one event as well.

    https://www.dropbox.com/s/4sv6lztqwvtxb ... .capx?dl=1

    For falling terrain you'd have to do something else. Perhaps a sprite per column of dirt that you'd slice up when destroying circles out of them. It wouldn't work if you wanted each pixel of dirt to have it's own color. For that you'd have to just move tiles around which will be slow so you'll want to use a very low res terrain and maybe change the idea entirely since looping over a lot of positions like that is not something that's fast in events.

  • I thought a large 1x1 px tilemap would be insanely slow. I underestimated C2 again..

  • It surprised me too when I first saw it used.

  • Thanks for reply. Your example working very well, but first I need to understand how Tilemap work. I'm gonna study this tomorrow. I was thinking of using just few big base tiles - 1 for flat ground, and 4 for high/low ground (left and right). Is it posible to build random Tilemap or array this way?

  • You can do it that way but you won't be able to destroy it per pixel.

    Well unless you draw the tiles per pixel onto the other. This is probably as tedious as it sounds but you probably could make a system to do it easier

  • I wasn't even interested in making this kind of games, but checked this thread just to see what was up. I was completely taken aback by your solution R0J0hound!! Who would think Construct 2 could handle this kind of stuff?!?

    Amazing!

  • I'm doing a prototype trying pixel destruction and this is just what i need.

    @R0J0hound Is there any way to add an sprite in the layout and when the layout starts make the tilemap adds tiles there?

    Or maybe other way to build a terrain using just sprites and on runtime add tiles in the tilemap so you can make any kind of terrain easily.

    I made a fake destruction pixel using the DestinationOUT blend

    The idea was then make if collides with building and is not overlaping one of the bullets with destinationOUT explode so you can make holes , but is not pixel precise and perfomance drops when losts of bullets blends , but well as first aproach was interesting .

    So, my idea is add a sprite, on runtime set tiles from tilemap there and use the destinationOUT to make the sprite looks destroyed equal i did for the blue buildings in the gif. But can't find a way to achieve the first step :S

  • Well just get it for Rectangular objects

    Wonder how get for the ones with alpha mmm...

    EDIT: One idea is paste that layer object into your canvas plugin and get the RGBA and detect if have alpha > remove tile. But i guess this means do an arrays that test all the pixels in the canvas looking for the alpha ones. Mmm, i will try later.

  • I think I’ve answered better many times in the past. To read pixels of an image you need a plugin like canvas. To read the collision polygon of a sprite per pixel you could use a bunch of overlapping point checks.

  • Here is an idea - set "Blend mode=source atop" for buildings and use tilemap as a mask. (and also as a solid surface for tanks)

    https://www.dropbox.com/s/bpy9vgw7df50z ... .capx?dl=0

  • Here is an idea - set "Blend mode=source atop" for buildings and use tilemap as a mask. (and also as a solid surface for tanks)

    https://www.dropbox.com/s/bpy9vgw7df50z ... .capx?dl=0

    Oh! The source Atop do the job well, thanks <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy">

    But i not understand why you dfill the objects in that way, is more faster/optimized after in runtime than this?:

    https://cdn.pbrd.co/images/GXI2AX5.png

    Ok, so now only the sprites with alpha left, so i guess in this case is use the canvas plugin to detect the alpha and erase the tiles with them or rework the tiles addition to run all coordinates in the canvas an set 1 tile in the tilemap for the ones that not have alpha, i don't know wich one will be better. BTW, i guess if after run i can save it as .json as described and load fast i think no matter.

    PD: dop2000 i bought you a coffe, i think, i don't know how much cost in australia XD

  • matriax

    Yes, your method of building tilemap is definitely better if buildings are rectangular. With complex shape buildings you might need to check overlapping for every pixel.

    What do you mean by sprites with alpha? Your buildings will have transparent parts ("windows") and you want to remove tiles in windows?

    You can make windows as another separate invisible sprite.

    So first you fill tiles where building sprites are, then erase tiles where window sprites are.

    Edit: Made a demo, with complex-shaped windows!

    https://www.dropbox.com/s/sywx2gcxi9qsh ... .capx?dl=0

    Cheers for the coffee! <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

    Although it's all based on R0j0's original idea, you should be thanking him.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • dop2000

    "With complex shape buildings you might need to check overlapping for every pixel."

    Are you saying is possible do complex buildings or recreate sprites with alpha in tileson tilemap without use the canvas plugin or i misunderstood you? :O if true, how? In your examples i tried to modify the sprite but not just fill the rectangular.

    Love what you did with the complex windows, maybe i can use that for explosion to make complex holes instead the round one.

    EDIT: Oh! :O just realized that changin the erase tile by set tile in your last example you can recreate that sprite based on their collision that is great. Wonder if there is a way to make them pixel precise using the sprite transparency instead the collision, but here maybe the canvas plugin is required

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