Navigation

    Fuze Arena Logo
    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    • Help
    • Discord

    Digging games

    Help
    9
    30
    1578
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Martin
      Martin Fuze Team last edited by

      Well I want to test it first! But my sticking point has always been the eating away of the tile pixel by pixel. Whether that tile is a sprite or an image. But just for once, if instead of a transparent background you give the player a black background with an alpha of 1 then you'll naturally appear to be eating away at the tile as you move and once they are over a certain threshold you remove the tile. Simplz

      1 Reply Last reply Reply Quote 2
      • Martin
        Martin Fuze Team last edited by Martin

        OK, my idea isn't going to work because as you travel along the dirt is removed with jagged edges and rounded corners:

        Screenshot 2020-05-02 at 00.44.20.png

        [EDIT] Oops, that's a bit large!

        1 Reply Last reply Reply Quote 1
        • xevdev
          xevdev F last edited by xevdev

          Use two layers back layer totally filled dirt
          Overlay a transparent screen and draw your tunnel on that screen. Looking at the edge pixels of the tunnel they repeat every 8 pixels each direction so if you want to remove dirt one pixel layer at a time you'd need eight images on the x and eight on the y or two pixels half that. Just keep track using mod to find which image to draw.
          Haven't played Mr do ? For a long time looks like it's set on a grid with the fruit .so keep track of the grid in an array - uses four bits to denote open or closed directions so you can program the enemies.
          Overlay your sprites over that.
          Oh yeah almost forgot give you tunnel image rounded corners.

          1 Reply Last reply Reply Quote 0
          • waldron
            waldron F last edited by waldron

            This post is deleted!
            1 Reply Last reply Reply Quote 0
            • waldron
              waldron F last edited by

              This post is deleted!
              1 Reply Last reply Reply Quote 0
              • PB____
                PB____ last edited by PB____

                Just looked at a short video on how Mr Do does this. It appears it just draws the background black where you walked (not really collision detection on the grass needed?) In that case you could probably just draw the grass of the level on an image, then draw black over that image where you have walked (not sure if you can erase part of a picture to become transparent, otherwise I'd go with that in stead of black, so the digging could reveal things that are drawn behind the image if that would be necessary).

                Eventually you just draw the updated grass image to the framebuffer that gets cleared every now and again (since you don't want to 'clear()' the grass image)

                #EDIT: You could almost certainly draw the grass image to the framebuffer using renderEffect(..) to use a specific mask color on the grass image as transparent (and use a render effect not to draw that coulor [I'm not brittish] to the framebuffer)

                DomDom Gothon 2 Replies Last reply Reply Quote 0
                • DomDom
                  DomDom F @PB____ last edited by

                  This post is deleted!
                  1 Reply Last reply Reply Quote 1
                  • PB____
                    PB____ last edited by

                    🇳🇱 well I wasn't thinking on how my typo would sound 😋

                    1 Reply Last reply Reply Quote 0
                    • Martin
                      Martin Fuze Team last edited by

                      Right, I need to put some of these ideas together and do some digging (ouch!).

                      1 Reply Last reply Reply Quote 2
                      • xevdev
                        xevdev F last edited by

                        Retrocade_media 1 Reply Last reply Reply Quote 5
                        • Retrocade_media
                          Retrocade_media F @xevdev last edited by

                          @xevdev are you not clearing the screen or just creating sprites?

                          xevdev 1 Reply Last reply Reply Quote 0
                          • Gothon
                            Gothon F @PB____ last edited by Gothon

                            @PB____ You can actually draw in transparent or partially translucent colors, but you have to change the blend mode to 0 using setBlend(0). With the default blend mode the colors will blend because of the transparency. So, you can have a background layer that is gradually revealed by writing transparent color to the foreground layer using render targets and blend modes.

                            1 Reply Last reply Reply Quote 2
                            • xevdev
                              xevdev F @Retrocade_media last edited by

                              @Retrocade_media no I'm not the background is a solid green and stays that way no need to alter it.
                              The tunnel screen is transparent and I draw image one movement at a time and don't clear so you can see the trail .
                              The actual game you'd draw your sprites straight over the top .
                              When your making a game you have your map in memory and what you display is on the screen is a representation of that.
                              In the case of this game it's set up on a grid that you cant get off so you can only turn every 16 pixels
                              Left right back forward
                              But you can go half way through a square the enemy needs to know that so the data for each square will need to allow it to only go so far .
                              So your data square will need to have more than a binary state
                              Open or closed
                              It will need to have both those and four directions with a number saying how far it's going in .
                              Or
                              You could Chuck the whole tunnel screen in an array for every pixel that's displayed there is a corresponding non zero number . write a getpixel that accesses that array
                              Only let the enemy move on the non zero area
                              I know which one I'd chose .

                              1 Reply Last reply Reply Quote 1
                              • Martin
                                Martin Fuze Team last edited by

                                So, I've been stuck on this for ages now! I think I need a mixture of both approaches. Currently I've got three layers 0, 1 & 2. Zero drawn first with no alpha. Right now it's just clear(green), then a layer where I draw the 'tunnels' in black with an alpha so that once I get to that point I can do whatever edges I want and then finally the sprite layer where, guess what? the sprites are drawn.

                                So far so good.

                                But I'm totally stuck on this whole business of being able to remove part of a tile and that's where the more i think about it, the more I need to consider this business of bitmasked values in the tile grid. And I also hadn't considered the prospect of the monsters needing to know if any of the tile directions are open.

                                1 Reply Last reply Reply Quote 1
                                • SteveZX81
                                  SteveZX81 F last edited by

                                  Crikey mate, that sounds so complex. but I'm sure you'll crack it in time.

                                  1 Reply Last reply Reply Quote 0
                                  • Martin
                                    Martin Fuze Team last edited by

                                    If you're referring to the bitmask thing then it's not as complex as it first sounds.

                                    So, let's say that we have a playfield that consists of 10 tiles high, 10 tiles wide (in reality you'd have more than this) The simplest implementation of that is that the array stores the tile number:

                                    tileData = [
                                        1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
                                        1, 0, 0, 0, 0, 0, 0, 0, 0, 1,
                                        1, 0, 1, 1, 0, 1, 1, 1, 0, 1,
                                        1, 0, 1, 1, 0, 1, 0, 1, 0, 1,
                                        1, 0, 0, 0, 0, 1, 1, 1, 0, 1,
                                        1, 0, 0, 0, 0, 0, 0, 0, 0, 1,
                                        1, 0, 0, 0, 0, 0, 0, 0, 0, 1,
                                        1, 0, 0, 0, 0, 0, 0, 0, 0, 1,
                                        1, 0, 0, 0, 0, 0, 0, 0, 0, 1,
                                        1, 1, 1, 1, 1, 1, 1, 1, 1, 1
                                    ]
                                    

                                    So that's a simple playfield where maybe image 1 is a wall and image 0 is the floor. But if we need to also store which of the directions is open to sprites then we need to look into binary. We know that an 8bit binary number can be up to 11111111 which in theory means that we can choose one of 256 tiles (if we include 0). But honestly, that's a LOT of tiles for an old-school game. So how about we instead limit ourselves to 16 tiles? Then we can split our number up. Now we can have 'dddd nnnn' where dddd are the directions that are "open" (U/D/L/R) and nnnn are one of 16 tiles. So 1100 0001 says that this grid position contains tile number 1 and can be entered from the 'UP' and 'DOWN' directions.

                                    Since we can use sprites for characters, and sprite images and animations can be entirely seperate to the tiles (using the image editor, or uploadImage() as you wish) 16 background tiles may be enough. But what if it isn't? Well an INT isn't limited to 8 bits, just extend it to 16 bits (0 to 65535) - PLENTY of room for images and to use the additional bits for all sorts of things.

                                    SO, in summary, yeah, maybe a complex sounding subject and now I've typed it out, maybe it is, but it's very powerful and would have been perfectly normal in the days where memory was limited.

                                    1 Reply Last reply Reply Quote 2
                                    • xevdev
                                      xevdev F last edited by

                                      If all you have is a hammer everything looks like a nail.
                                      Don't use the map function for the screen display
                                      If you want use it for sprite placement of apples cherries enemies but not tunnels
                                      The playable screen area is 192 by 208 pixels
                                      BitMap [192][208]
                                      Each time you draw a section of tunnel set the value in bitmap as well then just query it.

                                      Martin 1 Reply Last reply Reply Quote 0
                                      • Martin
                                        Martin Fuze Team @xevdev last edited by

                                        @xevdev said in Digging games:

                                        Don't use the map function for the screen display

                                        Do you mean the map editor? Because I've never used that.

                                        I'm struggling to grasp this a bit? If my tiles are 16x16 do you mean that whenever the player moves 1 pixel to the right I update 16 values in BitMap data? Isn't that going to be really slow? Or am I getting the wrong end of the stick?

                                        1 Reply Last reply Reply Quote 0
                                        • xevdev
                                          xevdev F last edited by

                                          Tell you soon just trying it out.

                                          1 Reply Last reply Reply Quote 0
                                          • xevdev
                                            xevdev F last edited by

                                            Na didn't slowdown I'll try and get a ball bouncing around the tunnel by checking bitmap

                                            1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post