How do I make a player dig?

0 favourites
  • 9 posts
From the Asset Store
Players follower. use it for anything which follows the player
  • Hi folks, I created a level (learning purpose) where I have the Bg and a sprite which is the ground.

    I'd like the player to press the down arrow and start to dig (kinda as the digger game does). How this can be achieved?

    Consider my "ground" is a jpg image of a terrain. Not sure if it can be done but still, I don't necessarily have to do it this way.

    When we dig, in some way we create a tunnel. I understand that if I dig "down" i will have walls on my two sides and in front of me, leaving an open tunnel behind me. If I dig left or right, the wall becomes an open tunnel repeating the previous concept.

    Can anyone explain how the digging works and how to achieve it?

  • It's possible to do this with a tilemap, but this method will only work with small levels. Here is an example:

    howtoconstructdemos.com/create-a-destructible-terrain-as-in-scorched-earth-with-a-tilemap-capx

    You can use the same tilemap as a mask for your ground sprite. Check out the official "Blend modes" template in C3

  • Thanks man. Why only with small levels?

    What about big ones?

  • A large tilemap with 1x1 px tile size will be bad for performance.

  • Got it. so which is the best way to do digging?

  • You need to give more details about your game. Is this a platformer? What do you do with the tunnel?

    The example I gave you is for a fully destructible terrain. If you need to dig in blocks or in a straight line, there may be other and easier options.

  • This is the situation:

    The space ship lands on the planet. Th player (platformer) walks on the planet ground. The planet ground is a sprite .png that covers the whole level.

    At a certain point i'd like to allow the player to dig into the terrain a create tunnels as he wish in order to find a key. So yes, basically everything should be diggable.

    Maybe what I want to do is to much stress for the system, I do not know, maybe there are other ways to do this?

  • Can you dig in rectangular blocks? This way you could use a tilemap with large tiles, which will not have performance issues. Check out this example:

    dropbox.com/s/8zap7yuhwdb0pcb/Farming_TileSet.capx

    It's for top-down view game, but you can use the same method for platformer ground. Left-click to dig, or press R to randomly change all tiles.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • This is cool, thanks, I have to check it out. Thanks man.

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