Monday, 22 March 2021

【GAMEMAKER】Pong Retro Game Remake

 Information about object: obj_player1

Sprite: spr_player1
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Step Event:
execute code:

if (keyboard_check(ord('W')))  {y-=5;} //move up
if (keyboard_check(ord('S')))  {y+=5;} //move down
if y<0 y=0;//stop going off top
if y>room_height y=room_height; //stop going off bottom

Information about object: obj_player2
Sprite: spr_player2
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Step Event:
execute code:

if (keyboard_check(vk_up))  {y-=5;} //move up
if (keyboard_check(vk_down))   {y+=5;} //move down
if y<0 y=0;//stop going off top
if y>room_height y=room_height; //stop going off bottom

Information about object: obj_wall
Sprite: spr_wall
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object

Information about object: obj_pong
Sprite: spr_pong
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
execute code:

motion_set(45,3);
Step Event:
execute code:

if x<0//check if off left of screen
{
    show_message("player 2 wins");
    game_restart();
}
if x>room_width//check if off right of screen
{
    show_message("player 1 wins");
    game_restart();
}
Collision Event with object obj_player1:
execute code:

hspeed*=-1;
Collision Event with object obj_player2:
execute code:

hspeed*=-1;
Collision Event with object obj_wall:
execute code:

vspeed*=-1;

No comments:

Post a Comment