• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GameMaker Help me improve my old view function usage

quattj

Member
My game project relies heavily on view usage. The automatic compatibility scripts seem to be working mostly well, but I am having a few issues with object movement, and I have lines of code that went from this:

if ((xval > view_xview[0] + view_wview[0]) or (xval < view_xview[0]))
to this:

if ((xval > __view_get( e__VW.XView, 0 ) + __view_get( e__VW.WView, 0 )) or (xval < __view_get( e__VW.XView, 0 )))​

That's pretty durn ugly.

So can someone tell me how I would best update my old view options to work natively with the new camera settings/functions? Basically, I need a reference of conversions of the old view functions into camera related functions... I think. Plus I need to set a camera to use.

Ones I can think of off the top of my head that I use:
view_xview
view_yview
view_hview
view_wview​

view_hspeed
view_vspeed​

Also, there are changes in lots of my objects that now look like

var __b__;
__b__ = action_if_variable(can_be_hurt, 1, 0);
if __b__
Curious why this would happen.
It used to be
if (can_be_hurt = 1)​

Is it because I originally used a single = for comparison instead of the double == ?
 

csanyk

Member
Also, there are changes in lots of my objects that now look like

var __b__;
__b__ = action_if_variable(can_be_hurt, 1, 0);
if __b__
Curious why this would happen.
It used to be
if (can_be_hurt = 1)​

Is it because I originally used a single = for comparison instead of the double == ?
Yes. It's interpreting your code as assigning a value of 1 to a variable, b. Replace with == and reimport, and it should be cleaner.
 
Top