So I spent a few days looking into how to change this:
- How to create tiles
- How to move tiles
- How to remove tiles
This was just the first day of work and gave me a lot of trouble. Creating these tiles at the start was not a problem: I used a nested loop (a for loop within a for loop) to create a grid of tiles that would fill up the screen when the game started.
Moving the tiles was not difficult. I had the chocolate block parent in place and could still use the global.vsp and global.hsp variables.
Removing the tiles was easy enough, instance_destroy took care of that.
Creating the tiles on the fly, during the game, that was challenging and took several days to make it work. I tried adding entire columns and rows when blocks leave the screen, I tried adding individual blocks, using 'source' blocks to add blocks and none of it worked. It took me just over a day of work to create it and make it work the way I wanted.
After that I wanted to include the destruction of blocks based on where the player was. First the block is set to invisible and when it is, it determines the adjacent, non-diagonal blocks and sets off an alarm in each one, so it updates its sprite to provide less of a 'clean break'.
Again that took a little bit of messing around, I initially had a sprite with 5 subimages to represent the block having various states of disconnection. This would be rotated to fit. This didn't work because of the centre point (and centre of rotation) being off-centre, in the top left corner. I also had to move the block back into place.
I settled on using a sprite with 16 subimages instead, representing all possible states a chocolate block can be in. This was a lot easier as I didn't have to move or rotate the block when changing its subimages. Two unintended but positive side effects:
- I can change each one of these subimages to break up any repetitive images.
- The gloss on all of the chocolate blocks is accurate. Highlights and shadows are all on the same sides of the block.
The sprites used for the chocolate blocks.
Top: Single chocolate block used before this destructive addition.
Middle: A sprite with 6 subimages I planned to use the first time and rotate into place.
Bottom: A sprite with 16 subimages I use now. This turned out to be a lot easier for me.
This is all working out just fine now, took a couple of days to get it working properly. All else was to add a couple of offsets to the player to make it look more like the drill is breaking up the chocolate in the world.
No comments:
Post a Comment