• 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!

GML [Solved] Replacement for view_xview/view_yview (Obsolete Function)

D

DumbChester

Guest
Hello, I needed help/advice about replacing view_xview/yview,
Thanks for taking your time to read this, So here it is.

In gm studio 1.x you can draw sprites that will follow flawlessly and automatically updates its position when you use views via
Code:
view_xview/view_yview
Old Method:
Code:
draw_sprite(sprite,subimg,view_xview+10,view_yview+10)
This method works perfectly.

but now in gm studio 2: they remove that and replaced it with camera/viewport stuff, so im using different methods to achieve the same reult that view_xviewyview gives.
Method 1:
Using camera_view stuff
Code:
Draw Event:
draw_sprite(sprite,subimg,(camera_view_get_x[camera_view[0]+padding),camera_view_get_y(camera_view[0])+10)
This method works but needs to be updated manually and causes a constant movement n the sprite whenever the object that the camera follows, moves.

Method 2:
Using draw_GUI instead of Draw
Code:
draw_sprite(spr,subimg,10,10)
in this method the sprite stays intact and doesnt need updating , BUT , it Scales the Sprite together with the viewport resolution,

So if your camera is 320x240
and your resolution is 1024x768
the sprite will be scaled down to match your resolution,
that makes your sprite look very tiny .

I can't seem to find a perfect replacement to drawing with view_xview/yview any help would mean a lot. TIA.
 
Top