Friday, October 13, 2017

GMS2 view_xview, view_yview

GameMaker Studio 2 has a list of obsolete function, including View Variables And Windows Functions.

From https://docs2.yoyogames.com/ , GMS2 introducing a camera function.

With the advent of the camera functions in GameMaker Studio 2, it means that a number of view variables are no longer required, specifically those referring to the view into the room rather than the view_port (which is still used). There are also a few functions for controlling how things are displayed that were available in legacy versions of GameMaker: Studio 1.4 which are also no longer appropriate. These variables and functions are listed below:

view_object     view_angle     view_xview     view_yview
view_hview     view_wview     view_hborder     view_vborder
view_hspeed     view_vspeed    
display_set_windows_vertex_buffer_method    
display_get_windows_vertex_buffer_method
display_set_windows_alternate_sync    
display_get_windows_alternate_sync    
room_set_view     


GMS1 center the view:
view_xview[0] = x - view_wview[0]/2;
view_yview[0] = y - view_hview[0]/2;

Alternative script for GMS2:
var view_xview = x - camera_get_view_width(view_camera[0]);
var view_yview = y - camera_get_view_height(view_camera[0]);
camera_set_view_pos(view_camera[0], view_xview/2, view_yview/2);

or obviously you can write it like this:
var view_wview = camera_get_view_width(view_camera[0]);
var view_hview = camera_get_view_height(view_camera[0]);

var view_xview_c = x - view_wview/2;
var view_yview_c = y - view_hview/2;
camera_set_view_pos(view_camera[0], view_xview_c, view_yview_c);

So we got a substitute for the code! We can continue to follow the GMS1 tutorial from youtube.
Well, not the greatest solution, but it works.
screenshake?
 
^_^




Monday, October 9, 2017

New Splash Screen GMS 2

Hey! A new update. Its Version 2.1.1.241 Download. Wed, 04 Oct 2017 08:37:57 Z. And it has a new randomize splash screen.

We can read the Release Notes here,
but here is the hightlight first four :



  • Added some cool new splash screens and now randomly choose which is shown.
  • Language files now have the standard 2-digit language code in them, and GMS2 will now auto-select its language for new installs by using your OS language.
  • Mac installer will now remove all previous files, cleaning out the installed folder.
  • New sprite editor filters added to help get rid of halos and glows around sprites.
The old splash screen.
... and the three randomize addition.



What do you think? :p