Simple Action Game [Tutorial]
|
first, you will need a player that can move.
To create a simple player movement, Follow these steps:
1. Create an object for the player.
2. Add movement behavior to the player object. You can use the "8 Direction Movement" behavior to allow the player to move in eight directions using the arrow keys.
3. In the event editor, add conditions that check for keyboard input. You can use the "Key is down" condition to check if a specific key is being pressed.
4. When a key is pressed, add an action to move the player object in the corresponding direction. You can use the "Move object" action and set the direction to the appropriate angle (e.g. 0 for right, 90 for down, etc.).
5. You may also want to add additional actions to control the speed of the player's movement or to limit the player's movement to the boundaries of the screen.
then, you will want your character to shoot
To create a shoot mechanic, follow these steps:
1. Create an object for the player and another object for the bullet.
2. In the event editor, add a condition that checks if the player has pressed a key to shoot. You can use the "Key is down" condition to check if a specific key is being pressed.
3. When the key is pressed, add an action to create a bullet object at the position of the player. You can use the "Create object" action to do this.
4. Add movement behavior to the bullet object so that it moves in the direction of the player's aim. You can use the "Bullet" behavior to do this, and set the speed and angle of the bullet based on the player's aim.
5. Add conditions to check for collisions between the bullet and enemy objects. You can use the "Object collides with another object" condition to do this.
6. When a collision occurs, add an action to destroy the bullet and subtract health from the enemy object.
then you'll need an enemy that can kill you
To create a simple enemy AI that can shoot, follow these steps:
1. Create an object for the enemy and another object for the bullet.
2. Add movement behavior to the enemy object so that it can move around the screen.
3. In the event editor, add a condition that checks if the player is within range of the enemy. You can use the "Distance between two points" condition to do this.
4. When the player is within range, add an action to have the enemy object rotate towards the player. You can use the "Set angle towards position" action to do this.
5. Add another condition that checks if the enemy is facing the player. You can use the "Compare two angles" condition to do this.
6. When the enemy is facing the player, add an action to have it create a bullet object that moves towards the player. You can use the "Create object" action to do this, and set the bullet's movement behavior to "Bullet" so that it moves towards the player.
7. Add a timer to control the rate of fire for the enemy. You can use the "Set timer" and "Compare timer" conditions to do this.
Now. when you have this, you need to make it so the player will die. unless the game will be boring with no competition
To make it so the player or enemy can die, follow these steps:
1. Create a variable for the player or enemy object that tracks their health or lives.
2. In the event editor, add a condition that checks if the player or enemy has collided with a bullet or other damaging object.
3. When the collision occurs, subtract a certain amount from the health or lives variable.
4. Add a condition that checks if the health or lives variable is equal to or less than zero.
5. When the health or lives variable reaches zero or less, add an action to destroy the player or enemy object.
this is the end
|
No comments have been posted for this article.
|
|