I am creating a simple spaceship combat game where the player creates the spaceship. The spaceship is created in a 'workshop' layout before the player uses their ship to defeat other ships in the level layout. The focus of the game is to experiment with different combinations of blocks to create ships with varying abilities.
I have so far only added two blocks into the game:
1. A ship_anchor block (grey), which is the centre of the ship and determines what the ship rotates around. Only one can be placed.
2. A rifle block (red), which automatically fires bullets at enemies (green) which fly towards the ship.
There are currently only 2 'spaces' to place these two blocks in the workshop layout, but I plan on having a 6x4 grid in the finished game.
However, I have encountered a problem which would force me to have create hundreds of events to get around, which I know slows down a game from a previous game I have made.
I want to be able to use a variable to tell the game what block to create in a space in the level layout of the game. At the moment I can only see one way of choosing which object to be created when a block is placed in a space in the workshop layout. This is to have a variable that stores the value of the block placed in the space, and have that block created in that space when going to the level layout.
The problem with this is that I have to create an event for every space being occupied by every block. For the amount of blocks I have planned to put in the game, that would be about (6x4)x12, which is equal to 288 events! I have created a game with a similar amount of events and variable before, and frame-rate averaged at about 55 when running. Frame-rate isn't my main concern however. I am more concerned that it will take me many hours to create every scenario for every block being placed in every space.
Is there any way for me to use a variable to create a specific block in a specific location? For example, if space1 is equal to 3, create block 3 in space 1 in the level layout?
Any help with this would be very much appreciated!