© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2023
B. TyersGameMaker Fundamentalshttps://doi.org/10.1007/978-1-4842-8713-2_27

27. Views

Ben Tyers1  
(1)
Worthing, West Sussex, UK
 
There are times when you will want a larger play area than the window itself. Views can be used for this. Game genres that may require this are
  • Space shooter.

  • Racing game.

  • Platformer.

Views can be set up using room settings or GML.

First let’s set up a player obj_player and obj_wall with sprites assigned to them, resized to 64x64 with the origin as middle center. In the Step Event of obj_player pop in:
if keyboard_check(ord("A")) {x-=2;}
if keyboard_check(ord("D")) {x+=2;}
if keyboard_check(ord("W")) {y-=2;}
if keyboard_check(ord("S")) {y+=2;} ...

Get GameMaker Fundamentals: Learn GML Programming to Start Making Amazing Games now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.