setting world limits and collision bounds in script????
by J Raven · in Torque Game Builder · 04/25/2012 (5:32 am) · 7 replies
im trying to set the world limits and collision bounds for an object in script as it spawns
im thinking that it should be set inside the object but im not sure if thats correct or what exactly to type
this is the object as is at the minuite
for the world limits i was thinking of doing this (changes between the comments)
or something like
in the objects onAdd() function but not sure exactly how to send it the required settings
as far as collision goes not a clue at all how to set them in script so would really appreciate a hand with this or a point in the right direction
any help on this would be greatly apperciated as im a little stumped right now
thanks a lot
J.
im thinking that it should be set inside the object but im not sure if thats correct or what exactly to type
this is the object as is at the minuite
%basicEnemy = new t2dAnimatedSprite()
{
sceneGraph = %this;
class = "basicEnemy";
layer = 4;
size = "16 16";
};for the world limits i was thinking of doing this (changes between the comments)
%basicEnemy = new t2dAnimatedSprite()
{
sceneGraph = %this;
class = "basicEnemy";
layer = 4;
size = "16 16";
//added these-----------------------
limitMode = "bounce";
minX = "-150";
minY = "-75";
maxX = "150";
maxY = "75";
callback = true;
//end-------------------------------
};or something like
(%this.setWorldLimit();
in the objects onAdd() function but not sure exactly how to send it the required settings
as far as collision goes not a clue at all how to set them in script so would really appreciate a hand with this or a point in the right direction
any help on this would be greatly apperciated as im a little stumped right now
thanks a lot
J.
About the author
www.goal7.co.uk
#2
04/25/2012 (11:56 am)
Pretty sure that already exists:object.setWorldLimit( bounce, "-100 -100 100 100" ); or object.setWorldLimit( kill, "-100 -100 100 100" ); or object.setWorldLimit( clamp, "-100 -100 100 100" );
#3
04/25/2012 (12:12 pm)
thanks Patrick was pretty sure it did exist but was unsure of exactly how to call it
#5
Thanks again
04/25/2012 (12:34 pm)
Excellent thats fantastic Patrick thank you was searching TDN all day but totally missed that.Thanks again
#7
Ive managed to do what I wanted thanks to a good bit of reading from your links
Got the world limits set and the collision poly
Cheers J.
04/25/2012 (2:09 pm)
Brilliant thank you very much Patrick you have helped me out loadsIve managed to do what I wanted thanks to a good bit of reading from your links
Got the world limits set and the collision poly
Cheers J.
J Raven
Goal 7
will this work????
%basicEnemy = new t2dAnimatedSprite() { sceneGraph = %this; class = "basicEnemy"; layer = 4; size = "16 16"; //will this work----------------------- worldLimit = "bounce, -150, -75, 150, 75, true"; //end---------------------------------- };bit of a crazy idea but i know that
from the basic tutorial 3 on tdn