Hey! I need to make dig dug game just like the following picture
Just need to know what should be a good approach for building dig dug game mechanics mainly digging logic.
One of the approach is to read pixels from the background texture and then set their value to 0 so that it can show digging effect.
Other approach is to have a small black texture and place it over the background where player moves.
If someone has anyother approach, do tell. Thanks!
This would be my first approach tbh. It’s a tile based game so this approach should be pretty straightforward.
Have a look at this sample, it could be something similar to creating little decals over your level.
https://playcanvas.github.io/#graphics/mesh-decals.html
@yaustar wouldn’t it will be costly to make too much small black textures over the whole texture?
Oh wait, dig dug isn’t tile based
Not really sure what my approach would be in this case. Generating a mesh for all the black areas is doable as mvaligursky mentioned. So it would be one mesh for the background and another for the black tunnel.
Editing texture data directly could work and is what I believe the video texture demo does.
Yeah i have seen its working let me try this in my code. Thanks @yaustar and @mvaligursky
I was working on an 8 bit version of DigDug and keep the tunnel information in two ways, well, three I guess!
The display is filled with dirt and the the tunnels blanked off in a tile based way, then as you move (in 2 pixel steps as in the arcade), a small 2 pixel chunk is blanked in the direction you move, this could probably be a rectangle covering the player.
I also keep a grid base (16x16 pixels) array of tunnel bits cleared in X and another for Y, this has a byte per grid cell and so as each 2 pixels are cleared, so is the corresponding bit, depending on the direction of travel. Once one direction is clear, the middle nits of the other are ANDed out.
When the player fires they can ignore the end bits/2 pixels if the are standing next to the tile although the monsters can’t go through, I think the Fygars can “fire” through.
https://stardot.org.uk/forums/viewtopic.php?t=26548