Okay so I am reading through sens tutorial on OOP and updating my game that I am making. It is much easier to code this way (IMO) but still hitting snags.
I am trying to get through this code:
House = function(){
this.floors = 4;
this.siding = "Red";
this.outputSiding = function(){
trace(this.siding);
};
};
// create an instance of the House class
myHouse = new House();
myHouse.outputSiding(); // traces "Red"
Now as it seems to me, I have nearly the same thing (I will condense this to save space):
//set new character function()
character = function (depth, x, y, charType, name, HP, MP) {
//sets stats used; this works fine :)
//attachMovie and set x/y
_root.attachMovie(this.name+"_mc", this.name+"MC", this.depth, {_x:this.x,_y:this.y});
/*this is where I am having trouble; it won't do anything!
I have tried tracing to no avail
also, can I set the x and y coords somehow with the
already made object x and y? I am tired right now and
can't think of a way but what I have done, which does
nothing as this function won't go!*/
statsBox = function(depth) {
this.depth = depth;
trace(this.depth+newline+'hello');
this.x = enemy._x+130;
this.y = enemy._y-50;
_root.attachMovie("stats_mc", statsNameMC, this.depth, {_x:this.x,_y:this.y});
};
};
enemy = new character(30, 350, 200, 'enemy', 'genericName', _root.EHP, _root.EMP);
enemy.statsBox(50);
that’s it, pretty much. So what’s wrong? Maybe I’m too tired for this right now…
thanks.