I am really hitting the planet building mechanic hard, because I haven't found a game that actually does this the way I do it in Rocket Boy. It's really fun and I'm having a lot of positive results on what can be created with it so far. I'm proud to say that planet building is Rocket Boy's main game mechanic, and I'd like to talk on that for a bit.
In Game Maker you have something similar to a 2d array called a ds_grid. This is a data structure in GM with many built in features a programmer can use to access and manipulate data in the array quickly and easily! So whenever I say "grid" or "ds_grid" you know what I'm referring to. Planet matter blocks can be moved in Rocket Boy. Only two objects in the game track planet matter; the planet core and the inventory object. There are only a few times when a block can be moved. The most used way a block is moved is from inventory to a planet core. During this process the inventory system calls it's specific block_transfer script. This script scans the grid of the destination planet core looking for empty cells (value of 0) with occupied cells (value greater than 0) adjacent to them. These empty cells are then marked with a different negative value depending on what direction the occupied adjacent cell lays. If the cursor moves to one of these cells with a negative value the planet matter block to be placed is drawn there and if the mouse left button is released the block is physically placed in that spot. Then the core grid is updated with the new values. The issue started when updating the core grid. I easily worked out drawing the grid on screen for the player to place his blocks, but Rocket Boy has view_angle shifting and so I have to find out how to draw the planet grid shifted with the view so that it still all matches (see screenshot below). Normally I would handle this sort of issue with my tried and true method of balling up in a corner and crying until the answer came to me, but I just don't have the time for that right now. Instead I decided to use my trusty old friend Google and sure enough the answer I did find in another game dev blog post for the game Heat Signature. You might have heard of Heat Signature, a game in development by Tom Francis @Pentadact. When the view_angle is shifted the center of the room stays at the same real world x and y values as well as the same GUI x and y values, so using the distance to object functions and length_dir functions built into GM:S I can easily rotate the GUI with the view-angle while drawing over real world x and y values. Well that's all for now. Short and sweet! Time to get back at it! I've got a Summer Sale going on over at itch.io, and a new version of Rocket Boy being released next month for Windows, OS X and Linux, so my work is cut out for me! Thanks everyone for the continued support and happy gaming!
0 Comments
Leave a Reply. |
EARLY ACCESS WITH ITCH.IO REFINERYNow available at Itch.io Refinery Early Access!!! |