R
RealsLife
Guest
I've This code
Inside the obj_vbar
Now when drawing the variables it looks like assigning them to variables inside obj_bar works but the formulas inside object bar just return NaN. Like you see the default variables are 0 and 0/0 returns NaN(Or at least I think that's what causes it). Also object_bar has a step event where the formules are used and real_surface_postion is the whole time changed based on the position.
How can I make this work? I just want the static obj_bar variables to be changed from another object so that for every different slider I make I can just use a prent a few variables and done.
Code:
event_inherited(); //parent gives his code
slider_value = obj_options_menu_controller.surf_height;
instance_create(x,y,obj_vbar);
obj_vbar_parent.scroll_power = 20;
obj_vbar_parent.slider_px_height = sprite_height;
obj_vbar_parent.real_slider_height = slider_value;
real_surface_position = obj_vbar_parent.real_surface_position;
Code:
//scrollbar limits
topLimit = obj_vslider_parent.topLimit;
bottomLimit = obj_vslider_parent.bottomLimit;
//bar start position
y = topLimit;
scroll_power = 10; //scrollpower
grab = false;
slider_px_height = 0; //hoogte sprite obj_vslider_parent.sprite_height;
real_slider_height = 0; //echte waarde scaled met hoogte sprite obj_vslider_parent.slider_value;
//real surface height variables scaled for your scrollbar
scroll_scale = real_slider_height/slider_px_height;
real_surface_position = 0;
px_on_slider = 0;
How can I make this work? I just want the static obj_bar variables to be changed from another object so that for every different slider I make I can just use a prent a few variables and done.