I have learnt all game maker code from scratch so I am trying to do some new things which i have never done before. I have used the gamer maker libraries and basic knowledge of code to develop what I have and I am going to include some examples.
|This is the code from the objEnemy which then checks if the enemy is being targets. If not it makes the enemy randomly stroll the map. If the enemy is targeted it makes it way towards the player. The last line then repeats the alarm with a random time.|
|objEnemy is actually a single object created, used and given different values depending on the situation. This piece of code will randomly generate enemies around the map.|
|Here we see the GUI being generated and drawn on the location of the player. The viewX and viewY variables are set by default and the GUI is drawn around these positions.|
|objBullet is also a single object that both enemies and player use to shoot. When the instance is created it's either sent from an enemy or player. Depending on whom it's sent by, isEnemy is set to true or false. As seen in the screenshot on the left, if isEnemy is true the sprite is change and the target is changed to the player, else the sprite is changed to a friendly bullet and the target is set to the players mouse.|
This piece of code is some basic world generation scripts. It draws sprites on the background for the entire room, with a for loop inside a for loop. The first for loop is for the width and the second for loop is for the height.
In future I will be adding some random generation like plants, lakes and other features to prettify the game.
By James Harrison, 24 May, 2018, 15:15