Posted in Game Maker Studio

Game Maker Studio Post #3 Asteroid left over

Okay so continuing from before, now I have successfully finished adding code for moving forward, wrapping it over the screen, a little something for smooth projectile rotation, logical shooting and objects at random to collide and shoot at?

I had the colors at minimum (black and white) well thats how Asteroid is…

I kinda got carried away with the game making that I ended up forgetting to document my moves and since I am currently packed with finding a domain for my project I am not gonna redo it and document it, I’ll most probably don one when I am free-er… *sigh

Trying to refresh:

  • Start a new project
  • Create a room
  • Create a sprite for the ship
  • Add the sprite to the Object
  • Add events to the Object 
    • left key                            image_angle = image_angle +2;
    • right key                          image_angle = image_angle +2;
    • up key                              motion_add(image_angle,0.2);if (speed > 5) speed = 5;
    • other-Outside room        Drag and drop the wrap around the window thing?
    • step                                   speed = max (speed – 0.1,0)
  • Add the Object to the Room 
  • Run the code using F5
 Apparently the Ship moves logically for me and since that is done let me go ahead and draw a few rocky sprites and upgrade the space ship with some guns!!!

Okay so from here, I added a new sprite (a few sprites) for the rock objects that need to be shot or collided with.

Asteroids :

Create event :  image_speed = 0;image_index = irandom(2);

Okay, why random? Cause I made multiple frames of the Asteroid so instead of animating (changing shape) it I placed it randomly on the screen and made the rocks to be of different shape throughout the game and gave it some speed. Now to deal with collision and death.

The asteroid can collide with either the Ship, the Bullet (another sprite that I thought I need not mention), another Asteroid or the wall.

Adding the collision events:

Click on the add events for the Asteroid and on clicking the Collision button choose the objects (ship, asteroid, bullet) for which the action is triggered?

Asteroid Collision:

Bullet :                          instance_destroy();
Ship :                             Drag and drop the Game Restart code…

I was thinking of colliding with the wall and bouncing off of it, but I am just gonna wrap it around the walls ; just like I did with the ship. And likewise for the bullet, for the outside room I added the instance_destroy(); cause I didn’t want the bullet to wrap around else it would become too messy.

Bullet Events and corresponding Actions:

Outside the room : instance_destroy();
Space bar click event : bullet = instance_create(x,y,obj_bullet); bullet.speed = 15; bullet.direction = image_angle;

That’s it I guess. The game is done and so is my time I’ll come back later and modify the things here…


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s