Game Development Community

Torque 2d Getting Started Video 6 problem

by Justin Theisen · in Torque 2D Beginner · 05/09/2013 (9:49 pm) · 4 replies

All was going well until I hit video 6.

My module complies and it runs but I see this

i884.photobucket.com/albums/ac43/icedragon8806/error01.jpg

My Log gives me no good information as to whats going on either :(


i884.photobucket.com/albums/ac43/icedragon8806/error01_log.jpg
My code is as follows

main.cs
function JustinToy::create(%this)
{
    exec("./scripts/justinScript.cs");
    JustinToy.mySpriteSize = 5;

    addNumericOption("Sprite Size", 1, 10, 1, "setMySpriteSize", JustinToy.mySpriteSize, true, "Determines the size of the sprite");
    
    JustinToy.reset();
}

function JustinToy::destroy(%this)
{
    echo("@@@ JustinToy::destory function called");
}

function JustinToy::reset(%this)
{
    SandboxScene.clear();

    SandboxScene.setGravity(0,0);
    
    %size = JustinToy.mySpriteSize SPC JustinToy.mySpriteSize;
    %position = "0 0";
    %sprite = buildJustinSprite(%position, %size);

    SandboxScene.add(%sprite);
}

function JustinToy::setmySpriteSize(%this, %value)
{
    JustinToy.mySpriteSize = %value;
}

justinScript.cs
function buildJustinSprite(%position, %size)
{  
    %sprite = new Sprite();

    %spite.Position = %position;
    %sprite.Size = %size;
    
    %spirte.Image = "ToyAssets:football";
    %sprite.setBodyType("static");

    return %sprite;
}

module.taml
<ModuleDefinition
	ModuleID="JustinToy"
	VersionId="1"
	Description="Justin Toy"
	Dependencies="ToyAssets=1"
	Type="toy"
	ToyCategoryIndex="5"
	ScriptFile="main.cs"
	CreateFunction="create"
	DestoryFunction="destory">
		<DeclaredAssets
			Path="Assets"
			Extention="asset.taml"
			Recurse="true"/>
</ModuleDefinition>




I don't see the issue but maybe it's something small.

About the author

Currently a Computer Science Major at Bowling Green State University. I've always had a passion for gaming and I am entering my final semester at school!

Recent Threads


#1
05/10/2013 (4:39 am)
The only mistake that stands out to me is that most of the time you write "destory" instead of "destroy" - but I'm not sure if that will fix your problem. I'd start with that though and see if it helps (you need to fix it in the main.cs AND the module.taml file).
#2
05/10/2013 (4:48 am)
You have this:

%spirte.Image = "ToyAssets:football";

You spelled %sprite wrong on that line. That means your actual %sprite is not getting an image.
#3
05/10/2013 (4:48 am)
You should fix that "desteroy" as well in your module definition, as Chase said.
#4
05/10/2013 (5:59 pm)
Thanks guys! I knew it was something small always is with my code. I was starting to get tired that's probably why I didn't catch that silly little mistake.