Problem One

Problem: A ball bounces around a room and the direction is random. When the demo starts you cant predict which way the ball will go. When the ball hits the wall you cant predict in which direction the ball will go  

Solution: 

Create Event: start moving in directions 111101111 with speed set relative to 7, set speed to 7 and direction to random(room_width)
Collision Event with object obj_wall: bounce not precisely against solid objects, move to a random position with hor snap 6 and vert snap 100, set speed to 7 and direction to random(room_height)

Leave a Comment

Filed under GameMaker

Problem Ten

Problem: A character jumps off a platform, and return under the infkuence of gravity – you cannot jump from midair  

Solution:

Step Event: if expression place_empty(x,y+1) is true, set the gravity to 1 in direction 270, else, set the gravity to 0 in direction 0
Collision Event with object obj_weetbix: set the vertical speed to 0
Keyboard Event for <Left> Key: move relative to position (-4,0)
Keyboard Event for <Up> Key: if relative position (0,1) is not collision free for Only solid objects, set the vertical speed to -15

Keyboard Event for <Right> Key: move relative to position (4,0)

Leave a Comment

Filed under GameMaker

Problem Six

Problem: A ball goes through a goal and the score goes up by one…the score does not go up if the ball misses the goal

Solution:

Step Event: if expression y<0 is true, set the score relative to 1, destroy the instance, create instance of object obj_ball at position (304,224)
Collision Event with object obj_wall: destroy the instance, create instance of object obj_ball at position (304,224)  
Other Event: Outside Room: move to position (304,224), start moving in directions 000010000 with speed set to 0  
Key Press Event for <Up> Key: set speed to 10 and direction to 45+random(90)

Leave a Comment

Filed under GameMaker

Problem Seven

Problem: Make a timer which counts up or down how much time is letf to play Solution:
Make an object called obj_timer (no sprite is needed) 

Create Event: set variable mytime to 10, set Alarm 0 to room_speed
Alarm Event for alarm 0: set variable mytime relative to -1, set Alarm 0 to room_speed
Step Event: if mytime is equal to 0, destroy the instance
Draw Event: at position (0,0) draw text: ‘time=’+string(mytime)

2 Comments

Filed under GameMaker

Problem Three

Problem: A character can move left and right with arrow keys and fires a single bullet forward when you press space bar. You have to release and press space bar again for more bullets.  Solution:

Keyboard Event for <Left> Key: move relative to position (-4,0)
Keyboard Event for <Up> Key: move relative to position (0,-4)
Keyboard Event for <Right> Key: move relative to position (4,0)
Key Press Event for <Space> Key: if sprite_index is equal to obj_plane, create instance of object obj_bullet at relative position (1,1) with speed 12 in direction 90

Leave a Comment

Filed under GameMaker