behaviors over classes?
by rennie moffat · in Torque Game Builder · 02/17/2010 (2:35 pm) · 5 replies
Hi, I am wondering, classes or behaviors? My only question being, behaviors would save me a bunch of reloads. My computer isnt the fastest so reloads kinda suck.
I would like to hear any opinions.
thanks.
Ren
I would like to hear any opinions.
thanks.
Ren
About the author
My thanks to Garage Games and the Garage Games Community combined with owned determination I got one game up, Temple Racer and I am looking to build more interesting, fun games for the mass market of the iOS app store.
#2
Using this behavior my, upon adding it to a floorImageMap, it disappears. but was still selectable as one little dot, so I zoomed in, and zoomed in, and zoomed in, and zoomed in and it still, the floorImageMap exist.
:wtf?
02/17/2010 (6:24 pm)
I forgot to mention something else, which I just noticed which I can not explain.Using this behavior my, upon adding it to a floorImageMap, it disappears. but was still selectable as one little dot, so I zoomed in, and zoomed in, and zoomed in, and zoomed in and it still, the floorImageMap exist.
:wtf?
#3
02/17/2010 (7:11 pm)
OK, my apologies, I have just noticed I left out the %this, for my sizing variables.
#4
02/17/2010 (11:14 pm)
You should be using both. I do hear that performance wise behaviors are slower, but asking behaviors or classes is like asking mallet or hammer. A mallet will put a nail in a wall and a hammer will secure wood. But a mallet might bend the nail and a hammer might break the wood. Use the right tool for the job.
#5
I suppose it is the game you are building. I will be building very light weight games for this year, relatively speaking of course So I am guessing, for now behaviors should do me fine. Tho, I thought differently about a lot of things than I do know, last week.
Thanks.
02/17/2010 (11:18 pm)
hmm, so what's the right job?I suppose it is the game you are building. I will be building very light weight games for this year, relatively speaking of course So I am guessing, for now behaviors should do me fine. Tho, I thought differently about a lot of things than I do know, last week.
Thanks.
Torque Owner rennie moffat
Renman3000
It will carry things like setSize, setPosition, setImageMap etc... does it not work.
In my case anyway I have built a behavior so I dont have to constantly relaod to make adjustments of things like size, image position etc, but why does it not work?
I imagine the same code in onLevelLoaded would.
if(!isObject(floorClassBehavior)) { %template = new BehaviorTemplate(floorClassBehavior); %template.friendlyName = "floor class behavior"; %template.description = "controls floor class"; %template.behaviorType = "Class Manager"; %template.addBehaviorField(floorImageMap, object, "floorImageMap", t2dStaticSprite); %template.addBehaviorField(floorGraphGroup, "", int, "7"); %template.addBehaviorField(floorWidth, "", float, "100"); %template.addBehaviorField(floorHieght, "", float, "100"); %template.addBehaviorField(floorPosX, "", float, "0"); %template.addBehaviorField(floorPosY, "", float, "0"); } function floorClassBehavior::onBehaviorAdd(%this) { %this.owner.setImageMap(%this.floorImageMap, 0); %this.owner.setGraphGroup(%this.floorGraphGroup); %this.owner.setSize(floorWidth, floorHieght); %this.owner.setPosition(%this.floorPosX, %this.floorPosY); }