Game Development Community

Pinball game

by Tom Feni · in Torque Game Builder · 07/25/2005 (2:56 pm) · 3 replies

Ok I moved it but I was wondering why this one works..
www.garagegames.com/mg/forums/result.thread.php?qt=28578

his works perfect and the ball even moves with the collision.. :)

I tried using some of the code in mine but the paddle just flies around.. :)

#1
07/25/2005 (2:56 pm)
The problem is your basicaly 'teleporting' your paddles to the new angle, not having them 'move'


function paddleLeft()
   {
   // Set the player moving up.
   $paddleLeft.setRotation(-35);
   $paddleLeft.setAngularVelocity(360);
   $paddleLeft.setAngularVelocity(0);


   }

setRotation instantly changes the angle of the object so that it's suddenly 'above' the current ball position, which then forces the ball to go down.

What you need to do is just use 'setAngularVelocity' or 'setAngularForce'. Unfortunatly T2D doesn't currently have rotation limits, so you'll need to create some objects that ONLY collide with the paddles to stop them at the maximum and minimum angles

BTW, this should probably be moved to 'T2D Scripting'
#2
07/25/2005 (3:37 pm)
He's using a schedual that is called every 100ms to check the position of the paddles to make sure they don't go beyond certain angles, and only using 'setRotation' if the paddle goes beyond its limit. His input routines also just set special bits that the adjustPaddles checks to determine what direction they should be rotating in.
#3
07/28/2005 (7:25 pm)
Oops
I thought I delete this thread.. oh well..

the question got answered and now to post a demo :)