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

Problem with camera and instances

T

Tarte

Guest
Hey! First of all thank you for reading my post. My question is the following :

I'm creating a game maker game (GML) and I want to make a life bar for my character.

Here is the code:

Code:
/// Quick Bar, Bar of Life and Mana Bar of the Character + Life of the Boss in relation to the camera:

var cx = camera_get_view_x (view_camera [0])
var cy = camera_get_view_y (view_camera [0])
var cw = camera_get_view_width (view_camera [0])

/// Manage the Character Life Bar:

ObjBarreViePlayer.y = cy + 1675
ObjBarreViePlayer.x = (cx + cw / 2) - 2000

/// Management of the Mana Bar of the Character:

ObjBarreManaPlayer.y = cy + 1900
ObjBarreManaPlayer.x = (cx + cw / 2) - 2000


(This is in the character's step and the objects are created at the beginning of the room)



The problem is that when I move my character, the Bar of Life and Mana shifts to the right when I go to the left and to the left when I go to the right.
(the number of pixels that my character is moving forward).



Voila if you have answers I'm interested and I specify that this post has been translated with google translation (yes I'm French and not very good in English;)) Tanks :)
 

Rob

Member
Shameless plug:


This should cover it! You are using an object to display those stats right?

You don't have to copy the code in the video, hopefully the explanation will help.
 
Top