【GameMaker】 Keep Player in View

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

view_wview[0]=600;//set wiew width
view_hview[0]=600;//set view height
view_enabled[0] = true;//enable view
view_visible[0] = true;//make visible
view_hborder[0]=250;//set horizontal border for object
view_vborder[0]=250;//set vertical border
view_object[0]=obj_player;//set object to follow

Step Event:
execute code:

//movement code
if (keyboard_check(ord('A')))  {x-=5;} 
if (keyboard_check(ord('D')))  {x+=5;} 
if (keyboard_check(ord('W')))  {y-=5;} 
if (keyboard_check(ord('S')))  {y+=5;}



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

room_goto(room_example);

No comments:

Top 3 UX Design Articles of 2024 to Remember

Based on most subscriptions ͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­...

Contact Form

Name

Email *

Message *