I've a parent and object recognising code[SOLVED]

R

RealsLife

Guest
So I've an object with a parent object but it doesn't recognise my code of that parent when I compile

Code:
slider_value = obj_options_menu_controller.surf_height;
instance_create(0,0,obj_vbar);
obj_vbar_parent.scroll_power = 10;
obj_vbar_parent.slider_px_height = sprite_height;
obj_vbar_parent.real_slider_height = slider_value;
All the code inside obj_vbar doesn't recnognise anything but I use a lot of the parent object code inside obj_vbar.
So why is this? I thought If I put a parent inside an object all the code would just be used inside that object and that I could override all the variables how I see necessary.

EDIT: The parent object is just variables and code that come before object_vbar
 
T

TDSrock

Guest
Seems like you assumed game-maker would just throw your code in for you. Consider this though. Where would the code be added? at the top? at the bottom? It's not clear.
Therefor GameMaker lets you chose EXACTLY where you want the code to be inherited.
See event_inherited for the details.

This behavior is simliar to draw_self.
If an object does not have a draw event of it's own it will autmaticly make one with draw_self() in it.
With inheritance it's the same. If there is no create event in the child. There will be one with event_inherited() in it.
 
R

RealsLife

Guest
Seems like you assumed game-maker would just throw your code in for you. Consider this though. Where would the code be added? at the top? at the bottom? It's not clear.
Therefor GameMaker lets you chose EXACTLY where you want the code to be inherited.
See event_inherited for the details.
Oh yea I assumed that xD I thought it would just put the parent object code before everything ^_^ thanks!
 
T

TDSrock

Guest
Oh yea I assumed that xD I thought it would just put the parent object code before everything ^_^ thanks!
No problem. I've elaborated my post a bit might aid you to know this already in the future.
 
Top