Game Development Community

Fixed: Adding Resources to Torque 2D

by Meredith F. Purk II · in Torque Game Builder · 10/06/2011 (3:20 pm) · 3 replies

I've fixed this, thanks to one last search of the forums after posting. Details in comments below.

I am attempting to implement a new resource into the engine source. (The Script Array Object as a matter of fact).

However, when attempting to create new instances of the object added via the resource (i.e., calling new array()) I get the 'unable to instantiate non-conobject' message. Attempting it manually from the console (~) gives the same result.

HOWEVER: If I try it through the level builder using that console (CTRL+~) it seems to work properly.

$testobj = new array();

Echoing the $testobj global gives me an object handle for the new array object.

Anyone have any ideas?

Edit: fixed formatting problems
Edit: fixed my own problem :P


#1
10/06/2011 (3:30 pm)
Note, this is similar to the problem Holmida was having here.

I just found this post after reading many other dead-ends and similar topics that didn't quite address my problem. I also realized that there are separate TorqueGameBuilder and TGBGame projects in the solution... I had added source to the TorqueGameBuilder project only, so exploring with that to see if that corrects my problem.
#2
10/06/2011 (3:47 pm)
Okay, I've fixed my problem thanks to the post by Holmida (referenced in my previous comment). In case anyone else is still new to building Torque2d projects: The T2D SDK solution will have two TGB projects w/source listed in it. One (TorqueGameBuilder) seems to be used by the level builder itself, the editor.

I had found that project first because it was highlighted when I first opened the solution and located the source files listed there. In order to get it to work in the games themselves, however, I also had to go into the TGBGame project and add the new source files there as well. I recompiled the entire solution for good measure and it seems to be working now.
#3
10/07/2011 (8:00 am)
Oh wow! what a great resource, just what I was looking for!
This would be a wonderful thing to have added to the upcoming bugfix release ;-)