Game Development Community

Pre-loading sprites with collision in Level Builder

by Tom Spilman · in Torque Game Builder · 04/19/2006 (4:46 pm) · 14 replies

First let me say that i see the pane on the right side of the TGB Level Builder window as a palette for items to add to your level.

With that frame of mind it seems logical that sprites added to the scene from there already have some default properties (like the collision poly) assigned to them. So far i see no way that this is possible as the pane seems to be just a list of image blocks.

Is there a way in the current level builder to pre-assign a collision poly (or other properties like script actions, sound effects, etc) to static sprites listed in the right hand pane?

Or am i mistaken on how the Level Builder is meant to be used?

About the author

Tom is a programmer and co-owner of Sickhead Games, LLC.


#1
04/20/2006 (8:30 am)
The Level Builder will support config datablocks in the next release. I'm not quite sure what you mean by sound effects and script actions (unless you mean class and superclass linking, which can be set in the config datablock).
#2
04/20/2006 (8:35 am)
I read on Mantis about the Config Datablocks, but I didn't know they were in the next release. Thank you for that.
#3
04/20/2006 (11:27 am)
I see that Justin wrote this on the mantis bounty:

Quote: As far as using object names are concerned, the preferred method of linking blocks to script is to define a t2dSceneObjectDatablock that defines the namespace as it's 'Class' or 'SuperClass' field. This will allow you to select a block from the create panel as the config datablock. For example, in your case perhaps BreakableBlockConfig or something similar.
This isn't very clear as to what a "config datablock" is and how it's used. Matt could you give us a better description of it's use... preview of what is coming? =)
#4
04/20/2006 (11:30 am)
That's what I was referring to, without the quote. :)
#5
04/20/2006 (1:32 pm)
Definately... actually config datablocks have been around for quite a while, possibly since the beginning of T2D (lol it hurts my head to think back that far), though it will be supported in the next Level Builder... Here is an example of the Mighty Fist config datablock

new t2dSceneObjectDatablock(MFPlayerConfig)
{
   defaultScriptClass = "MFPlayer";
   layer = $playerLayer;
   group = $playerGroup;
   worldLimitMode = "CLAMP";
   worldLimitMin = "-85.000 -427.349";
   worldLimitMax = "376.254 60.000";
   collisionActiveSend = true;
   collisionActiveReceive = true;
   collisionPhysicsReceive = false;
   collisionLayers = $platformLayer SPC $platformObjectLayer;
   collisionGroups = $platformGroup SPC $platformObjectGroup;
   collisionPolyList = "-0.63 0.87 0.03 0.87 -0.09 -0.51 -0.28 -0.51";
   maxLinearVelocity = "250";
   constantForce = "0 300";
   graviticConstantForce = true;
   friction = "0";
      runSpeed = "60";
      airSpeed = "30";
      jumpHeight = "13";
      punchDamage = "10";
};
#6
04/20/2006 (2:33 pm)
@Matt - Thanks. This is exactly what we were hoping for in putting together our new TGB pack. This allows us to package sprites with existing collisions and script classes so that the user can just drop in the pack and start building.
#7
04/20/2006 (3:26 pm)
Very nice, good stuff :)
#8
04/20/2006 (3:28 pm)
Yeah, great! Thank you.
This will come in very useful. :)
#9
04/21/2006 (4:45 am)
Oh now that looks useful. I was worried that the Level Builder would not work easily with custom script objects, but looks like I was wrong. Glee!
#10
04/21/2006 (4:58 am)
How about an option to "datablockify" a sceneobject in the level editor? Like your are creating an enemy or something for your game in the level editor (with all the useful stuff as collision poly editor and so on) and then click on a "make datablock" button. Then a new window opens up and where can select which fields of the object should get copied to the datablock (eg.: collision poly, class, superclass, but not position and speed). You type in a name for your datablock, click on save and it gets added to the managed datablocks of your project. This way you can make use of all level editor functionality and make use of datablocks. Sounds very sound to me :)
#11
04/21/2006 (11:30 am)
That's a great idea Michael.
#12
04/21/2006 (9:07 pm)
Great idea, in fact we already thought of the same idea :) Its actually been on our wish-we-had-time list, no promises if it'll make next release or not.
#13
04/22/2006 (7:28 am)
Sorry if the following is a dumb question. While t2dSceneObjectDatablocks may have been around for quite a long time, I can't see anything in the reference.pdf that explains how to use them. For imageMapDatablocks and collisionMaterialDatablocks, I would load them by:

%myObj.setImageMap(myDatablock);
%myObj.setCollisionMaterial(myDatablock);

What is the function that loads a SceneObjectDatablock?

Similar question for scroller and sceneGraph datablocks.
#14
04/22/2006 (7:40 am)
That would be awesome! I was just thinking about loading a bunch of sprites on my level, then realized I would have to create the collision polygon for each one of them. There must be a shortcut (since we don't have the next level editor release).