New Object must mount
by rennie moffat · in Torque Game Builder · 01/11/2010 (11:27 am) · 3 replies
Hi there, I am making a plinko type game where the player, at the top of the screen can drop the ball... when the ball reaches about 2/3s down the screen I want a new ball to be created. This new ball will need to mount the player, in what ever position he is in at the top of the screen.
It is proving slightly tricky, but if I follow along the spawn lessons, It should work.
Currently I am thinking something like this.
I have both ball and guy as behaviorfields (t2dStaticSprite)
It is proving slightly tricky, but if I follow along the spawn lessons, It should work.
Currently I am thinking something like this.
function ballManagement::updateBallStatus(%this)
{
%ballPosition = %this.owner.getPosition();
if(%ballPosition > 105)
%ball = new t2dStaticSprite(%this.ball);
%ball.mount(%this.guy);
if(%ballPosition > 170)
%this.owner.safeDelete();
}I have both ball and guy as behaviorfields (t2dStaticSprite)
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
but thanks.
I am working in my head if I should give the behavior to the ball, so when space is pressed, owner(ball) is dismounted from guy. However, all shooting behaviors that I have seen are given to the guy (playerclass).
should this be of any major concern, thought.
01/11/2010 (3:49 pm)
oh right, so getWord, thanks. sloppy writing I know... but with the basic idea, it vvill work Im sure.but thanks.
I am working in my head if I should give the behavior to the ball, so when space is pressed, owner(ball) is dismounted from guy. However, all shooting behaviors that I have seen are given to the guy (playerclass).
should this be of any major concern, thought.
#3
01/11/2010 (8:38 pm)
Another way you can accomplish this is to create a big trigger object where you want the event to happen, should be more efficient this way rather than constantly checking (which looks to be the way you are doing it now?) :)
Torque 3D Owner Marc Dreamora Schaerer
Gayasoft
Also you are missing the {...} around the if block content