A New Tutorial Series - The Breakout Tutorial
by Tetraweb · in Torque Game Builder · 03/29/2008 (12:17 pm) · 78 replies
Hi, I have a seven part tutorial series on creating a Breakout/Arkanoid type of game. I am almost finished with part seven, so I thought I would begin posting the first parts in the series now.
Overall Goal of the Series
This series began as an experiment a year ago, while I was teaching myself how to program in TorqueScript. I began writing notes for my own use on how to do certain things. These notes kind of spontaneously organized themselves into a tutorial, and I found that I liked writing it. It was also a great way to help solidify things in my mind.
A Few Things to Note
What? No Behaviors?
There are no behaviors whatsoever used in this tutorial. I began writing Part 1 when TGB was at version 1.13, but that's not why I didn't include behaviors. The main thrust of this series is scripting, using TorqueScript to accomplish things; building logical, understandable code to create a game.
Behaviors are a method of abstracting code into a LevelBuilder drop down. They are not always the correct choice. For one thing, they add a certain amount of overhead, both in amount of code and in complexity, which is not always necessary, particular for simple object actions. Also, they may lead to a certain sameness across your games, it's almost too easy to build a game from your set library of behaviors that you always use, perhaps hindering innovation.
Now, I'm not really against behaviors, and may use them in a future tutorial, but I wanted to present a complete game that did not use them.
Breakout? What is this 1987?
I'm a real fan of TGB, I think it has a tremendous amount of potential. When people first begin using it, they almost always begin thinking along the lines of platformer or side scroller, assuming that is its natural strength. I disagree, I think it is perfectly suited for almost every casual game you can think of.
I'm not a huge fan of breakout in particular, but I love all kinds of casual games; matching games, card games, unusual logic games. The BreakoutTutorial started almost randomly, I think, because the last game I had been playing was a wonderful Arkanoid kind of game called BreakQuest. As I played it, I thought "I bet TGB could do this."
A Finished Game
Part of the goal of the series, and one reason it is so long, is that I wanted to have, at the end, a complete and finished game. Sound effects, music, particle effects, game logic, multiple levels, high scores, game state saving (unlocking levels,) etc. I didn't want to create a tutorial that provided a shell of a game, and then tells the user, "OK, now finish it up!"
Intended Audience
The intended audience for this series is everyone. I wrote it with a beginning user in mind, so if you have been using TGB for a while, you may find some step details too obvious. However, I would not hesitate to recommend it to intermediate or even advanced scripters. It's fun, and you may learn some TorqueScript techniques or methods you haven't been using.
I do urge everyone who follows the tutorial to read it completely. Just jumping from code section to code section and copying and pasting will teach you nothing, and you may miss some important information. For very new users, I promise you that if you take it slowly, digesting every part of it and understanding each line of the code you are pasting in, by the end of part seven you will have a pretty firm command of TGB.
Well, that was a longer preamble than I had intended, so here is the link to part 1 of the series.
The Breakout Tutorial - Part 1
I'm putting up parts one, two and three today. Part four should go up tomorrow, and five shortly after that. The final two parts will go up a little bit later as I proof and test them, but I'm hoping it will all be up in the next week or so.
I am going to start a thread for each subsequent part, which I intend to be used for discussion, questions, etc.
Thanks,
Greg
Overall Goal of the Series
This series began as an experiment a year ago, while I was teaching myself how to program in TorqueScript. I began writing notes for my own use on how to do certain things. These notes kind of spontaneously organized themselves into a tutorial, and I found that I liked writing it. It was also a great way to help solidify things in my mind.
A Few Things to Note
What? No Behaviors?
There are no behaviors whatsoever used in this tutorial. I began writing Part 1 when TGB was at version 1.13, but that's not why I didn't include behaviors. The main thrust of this series is scripting, using TorqueScript to accomplish things; building logical, understandable code to create a game.
Behaviors are a method of abstracting code into a LevelBuilder drop down. They are not always the correct choice. For one thing, they add a certain amount of overhead, both in amount of code and in complexity, which is not always necessary, particular for simple object actions. Also, they may lead to a certain sameness across your games, it's almost too easy to build a game from your set library of behaviors that you always use, perhaps hindering innovation.
Now, I'm not really against behaviors, and may use them in a future tutorial, but I wanted to present a complete game that did not use them.
Breakout? What is this 1987?
I'm a real fan of TGB, I think it has a tremendous amount of potential. When people first begin using it, they almost always begin thinking along the lines of platformer or side scroller, assuming that is its natural strength. I disagree, I think it is perfectly suited for almost every casual game you can think of.
I'm not a huge fan of breakout in particular, but I love all kinds of casual games; matching games, card games, unusual logic games. The BreakoutTutorial started almost randomly, I think, because the last game I had been playing was a wonderful Arkanoid kind of game called BreakQuest. As I played it, I thought "I bet TGB could do this."
A Finished Game
Part of the goal of the series, and one reason it is so long, is that I wanted to have, at the end, a complete and finished game. Sound effects, music, particle effects, game logic, multiple levels, high scores, game state saving (unlocking levels,) etc. I didn't want to create a tutorial that provided a shell of a game, and then tells the user, "OK, now finish it up!"
Intended Audience
The intended audience for this series is everyone. I wrote it with a beginning user in mind, so if you have been using TGB for a while, you may find some step details too obvious. However, I would not hesitate to recommend it to intermediate or even advanced scripters. It's fun, and you may learn some TorqueScript techniques or methods you haven't been using.
I do urge everyone who follows the tutorial to read it completely. Just jumping from code section to code section and copying and pasting will teach you nothing, and you may miss some important information. For very new users, I promise you that if you take it slowly, digesting every part of it and understanding each line of the code you are pasting in, by the end of part seven you will have a pretty firm command of TGB.
Well, that was a longer preamble than I had intended, so here is the link to part 1 of the series.
The Breakout Tutorial - Part 1
I'm putting up parts one, two and three today. Part four should go up tomorrow, and five shortly after that. The final two parts will go up a little bit later as I proof and test them, but I'm hoping it will all be up in the next week or so.
I am going to start a thread for each subsequent part, which I intend to be used for discussion, questions, etc.
Thanks,
Greg
#42
Perhaps a note that someone using Torsion needs to go into common/gameScripts/properties.cs and change the DefaultScene right at the bottom to the correct name...
08/11/2008 (10:32 pm)
Greg, I just restarted this tutorial and my first test resulted in a unending repeated error on the setImpusleForce line for $thebase. Issue is that I'm running it from Torsion, not from the TGB editor, and Torsion still thinks my default level is Untitled.t2d.Perhaps a note that someone using Torsion needs to go into common/gameScripts/properties.cs and change the DefaultScene right at the bottom to the correct name...
#43
Am starting with TGB and this tutorial seems ideal.
However I have a problem when testing part 1 of the tut. In the IDE I mount the Arch to the Base. When the program is tested, the arch does not follow the base, as if it was not mounted.
When exiting test mode, now both parts are as if they never were mounted, and I have to mount again. As long as I do not run the program, they remain mounted.
Everything else work as expected.
I have Vista home premium and my laptop is well equipped for 3D. For running TGB 1.7.4 I have to disable desktop composition, visual themes and run in XP2 compatibility, or the visual controls (scrollbars and buttons) in the IDE won't respond. This of course disables AERO. Usually the IDE crashes on exit. But compiled programs work fine in normal vista environment.
EDIT: I forgot to mention that disabling Aero is needed only if TGB is used in OpenGL mode. In D3D all controls work fine, but the mentioned problem with the game and the crash on exit still happen. I insist on working with OpenGL because am trying to make Mac compatible games.
10/02/2008 (10:09 pm)
Hi.Am starting with TGB and this tutorial seems ideal.
However I have a problem when testing part 1 of the tut. In the IDE I mount the Arch to the Base. When the program is tested, the arch does not follow the base, as if it was not mounted.
When exiting test mode, now both parts are as if they never were mounted, and I have to mount again. As long as I do not run the program, they remain mounted.
Everything else work as expected.
I have Vista home premium and my laptop is well equipped for 3D. For running TGB 1.7.4 I have to disable desktop composition, visual themes and run in XP2 compatibility, or the visual controls (scrollbars and buttons) in the IDE won't respond. This of course disables AERO. Usually the IDE crashes on exit. But compiled programs work fine in normal vista environment.
EDIT: I forgot to mention that disabling Aero is needed only if TGB is used in OpenGL mode. In D3D all controls work fine, but the mentioned problem with the game and the crash on exit still happen. I insist on working with OpenGL because am trying to make Mac compatible games.
#44
any idea why is that? here is the code
and on collision
thanks in advance and sorry my bad english.
10/03/2008 (6:01 pm)
Hi there, im just new with TGB im following the phases of this tutorial, everything was going ok but a problem appears when i start to move the ball. you see it bounces well when it hit the wall at 1 to 60 degrees(aprox), the problem is whe it hits the walls at 70 to 89 degrees (aprox) then the balls stuck and is collising (?) constantly i know couse i can see the bounce particle effect.any idea why is that? here is the code
function newBall(%ballLoc,%ballVector) {
%theball = new t2dStaticSprite() {
scenegraph = $thescenegraph;
imageMap = "basicballImageMap";
canSaveDynamicFields = "1";
Position = %ballLoc;
size = "5.000 5.000";
class = "ballClass";
CollisionActiveSend = "1";
CollisionActiveReceive = "1";
CollisionPhysicsSend = "1";
CollisionPhysicsReceive = "0";
CollisionCircleScale = "0.7";
CollisionDetectionMode = "CIRCLE";
CollisionResponseMode = "BOUNCE";
CollisionCircleSuperscribed = "0";
};
%theball.setCollisionMaxIterations(3);
%theball.setMass(10.8);
%theball.setMaxAngularVelocity(4);
%theball.setMaxLinearVelocity(150);
%theball.setRestitution(1.0);
%theball.setFriction(0);
%theball.setCollisionCallback(1);
%theball.setConstantForce( 0, 0.5, true );
%theball.setLinearVelocity(%ballVector);
%theflow = new t2dParticleEffect() {
scenegraph = $thescenegraph;
effectFile = "~/data/particles/flow.eff";
useEffectCollisions = "1";
effectMode = "INFINITE";
effectTime = "0";
size = "15.000 15.000";
};
%linkIndex = %theflow.mount(%theball, "0.000 0.000");
%theflow.playEffect(false);
%theball.myFlow = %theflow;
return %theball;
}and on collision
function ballClass::onCollision(%srcObject, %dstObject, %srcRef, %dstRef, %time, %normal, %contacts, %points) {
if (%dstObject.class $= "paddleClass") {
%speed = getword($thebase.getlinearVelocitypolar(),1);
if (%speed > 150) {
%force = t2dVectorScale(%normal,-(%speed*2));
%srcObject.setImpulseForce(%force, false);
}
$wallbang.setPosition(%points);
$wallbang.playEffect(false);
} else if (%dstObject.class$="wallClass") {
$wallbang.setPosition(%points);
$wallbang.playEffect(false);
}
}or maybe is somewhere else.. but im newbie on on this and i don't know where.thanks in advance and sorry my bad english.
#45
i see too a pseudo hack solution that don't work for me. Maybe i made wrong the code.. Others says that is a engine problem god i wish is not, i buy tgb today and getting the notice that a simple ball bouncing can't be perfectly done is lame.
if some expert on tgb can light me with his wisdom i'll be grateful really
maybe you Greg? sorry the bothering and really sorry for my english
the tutorial is great i get familiar with the script pretty fast thank you i really wish don't abandon it just for that damn bug/error/whoknows?
10/03/2008 (10:48 pm)
I just don't get it i see it again and again but i can't make it work.. now i believe that the stuck position is a certain area belive it or not. i can get the ball get stuck shotting her to the corner, tomorrow ill try to make the ball object with the visual enviroment (not script) and see what happens, i search for others posts and i see that some ppl get the same problem, so any of those can tell me if he make it work?i see too a pseudo hack solution that don't work for me. Maybe i made wrong the code.. Others says that is a engine problem god i wish is not, i buy tgb today and getting the notice that a simple ball bouncing can't be perfectly done is lame.
if some expert on tgb can light me with his wisdom i'll be grateful really
maybe you Greg? sorry the bothering and really sorry for my english
the tutorial is great i get familiar with the script pretty fast thank you i really wish don't abandon it just for that damn bug/error/whoknows?
#46
Tetraweb,
I'm really going to need you to post the completed text for all the final .cs files because as is I'm drowning over here.
I'm on try #4 with v1.7.4 on XP, having spent numerous hours working on combinations of retyping code, shuffling function scripts into unintended .cs files and subfolders in a three step "Frankenstein" process just to make things work like they should as shown using just one step.
I'm also getting suspicious that using Torsion might be making things worse because of some unforeseen incompatibility issues. I'm having similar problems to those posted above, but the fixes they use aren't working in my project.
The breaking point that prompted me to post this was finally getting almost everything to work in section 1, going in to make the particle effect stop when the saucer isn't moving only to have it then tell me the particle effect did NOT exist in the correct folder all the while it clearly did.
Did I possibly put text in the wrong .cs file, folder, etc? Most likely!
But as this tutorial is set up in pieces of spread out code without a completed reference, getting things setup right is looking like too much work and that's a bad sign this early on especially since I've already got some decent experience using Actionscript 3.0 & MEL (Maya) script and I don't have much free time to spend learning this program as is.
To your concern that you don't want people to simply copy and paste the finished code to complete this game, bypassing all the detailed work you've put in, the people who do that are simply NOT GOING TO MAKE GOOD GAMES!
They will either realize this and have to come back and do all these tutorials again from scratch following your notes, or they will get bored/frustrated and quit like they were going to all along.
12/24/2008 (11:05 am)
Hi, it's a little more complicated than that, because the scripts are spread out among several separate .cs files; also I am afraid it would encourage people to simply skip to the end and copy all the scripts without doing the tutorial. I put too much effort into it to not have people learn from it. :)Tetraweb,
I'm really going to need you to post the completed text for all the final .cs files because as is I'm drowning over here.
I'm on try #4 with v1.7.4 on XP, having spent numerous hours working on combinations of retyping code, shuffling function scripts into unintended .cs files and subfolders in a three step "Frankenstein" process just to make things work like they should as shown using just one step.
I'm also getting suspicious that using Torsion might be making things worse because of some unforeseen incompatibility issues. I'm having similar problems to those posted above, but the fixes they use aren't working in my project.
The breaking point that prompted me to post this was finally getting almost everything to work in section 1, going in to make the particle effect stop when the saucer isn't moving only to have it then tell me the particle effect did NOT exist in the correct folder all the while it clearly did.
Did I possibly put text in the wrong .cs file, folder, etc? Most likely!
But as this tutorial is set up in pieces of spread out code without a completed reference, getting things setup right is looking like too much work and that's a bad sign this early on especially since I've already got some decent experience using Actionscript 3.0 & MEL (Maya) script and I don't have much free time to spend learning this program as is.
To your concern that you don't want people to simply copy and paste the finished code to complete this game, bypassing all the detailed work you've put in, the people who do that are simply NOT GOING TO MAKE GOOD GAMES!
They will either realize this and have to come back and do all these tutorials again from scratch following your notes, or they will get bored/frustrated and quit like they were going to all along.
#47
01/10/2009 (4:09 pm)
Hi, how do I create the a new .cs file?
#48
01/10/2009 (7:32 pm)
Just use a text editor like Notepad, emacs or vi. Make sure to save the file with an extension of .cs instead of .txt.
#49
it doesn't say it in the tutorial?
01/11/2009 (4:53 pm)
Should there be a wall on the bottom as well?it doesn't say it in the tutorial?
#50
01/11/2009 (5:58 pm)
No, there should definitely not be a wall on the bottom. One of the classic elements of Breakout gameplay is that if the ball gets past your paddle (or spaceship, in this case) it's lost.
#51
I did everything correctly, I ran the game and nothing happens.
The ship does not move.
I left out the particle effect because I was having trouble setting the particle image to CELL.
01/11/2009 (11:10 pm)
Honestly, what is suppose to happen at the end?I did everything correctly, I ran the game and nothing happens.
The ship does not move.
I left out the particle effect because I was having trouble setting the particle image to CELL.
#52
I adjusted the base and the shield polygon.
Now my ship move slowly to the left of the screen on its own.
Is that normal?
01/11/2009 (11:25 pm)
I think I did something right.I adjusted the base and the shield polygon.
Now my ship move slowly to the left of the screen on its own.
Is that normal?
#53
03/04/2009 (7:21 am)
Anyone know if parts 6 and 7 are still planned or are they lost in the maelstrom usually known as not-enough-time-in-a-day?
#54
Just a quick comment, In Part 5, in the "Moving On" Section, shouldn't the file in the third sentence be "tiles.cs" and not "tile.cs"?
Thanks!
04/07/2009 (7:51 am)
Love the tutorial so far...Just a quick comment, In Part 5, in the "Moving On" Section, shouldn't the file in the third sentence be "tiles.cs" and not "tile.cs"?
Thanks!
#55
It's a little pity that I found out the tutorial was posted here in last year. So there maybe little hope that I can see part 6 and 7 because it's delayed for more than a year.
I want to say thanks to Tetraweb here. :)
04/26/2009 (10:26 am)
Nice tutorial, I finished learning all 5 parts.Then I found that part 6 and 7 are left blank. It's a little pity that I found out the tutorial was posted here in last year. So there maybe little hope that I can see part 6 and 7 because it's delayed for more than a year.
I want to say thanks to Tetraweb here. :)
#56
06/28/2009 (1:10 pm)
what would be the possible reasons for the basetail effect to not work? i've read over the section that explains what to do so many times i have even copy and pasted the code to make sure that i didn't spell anything wrong ty for any help
#57
Thanks for the tutorial by the way!
06/28/2009 (5:48 pm)
I've been having the collision problem myself as well. The ball occasionally get stuck against a wall or solid block. I have a bit of script that may be helpful.function ballClass::onCollision(%srcObject, %dstObject, %srcRef, %dstRef, %time, %normal, %contacts, %points)
{
if (%dstObject.class $= "paddleClass")
{
%dstObject.schedule(100,"makeHittable");
%dstObject.setCollisionActive(0,0);
%speed = getword($thebase.getlinearVelocitypolar(),1);
if (%speed > 150)
{
%force = t2dVectorScale(%normal,(-%speed*2));
%srcObject.setImpulseForce(%force, false);
}
$wallbang.setPosition(%points);
$wallbang.playEffect(false);
%r=getRandom(1,2);
%hitsound="shieldhit"@%r;
alxPlay(%hitsound);
}
else if (%dstObject.class $= "wallClass")
{
%srcObject.schedule(10,"makeHittable");
%srcObject.setCollisionActive(0,0);
$wallbang.setPosition(%points);
$wallbang.playEffect(false);
alxPlay(wallhit);
}
else if (%dstObject == $thetileset)
{
%srcObject.schedule(10,"makeHittable");
%srcObject.setCollisionActive(0,0);
$wallbang.setPosition(%points);
$wallbang.playEffect(false);
$thetileset.hitTile(%dstRef,1.0);
}
}In the attached script, I've modified the ballClass function to turn off collision on the ball for a brief time in order to let it turn around and not get stuck in the collision. Haven't seen any problems caused by it so far.Thanks for the tutorial by the way!
#58
i ran into another wall, creating levels, i modified and saved the buttons for the mainscreenGUI for levels 4 5 and 6 4 images each levelx.png .eve.x_i.png, levelx_d.png and levelx_h.png in the gui buttons folder, i modified the mainmenuGUI to make them appear and show up yet they are always "active" buttons even though inactive is set to 1.
Upon loading the "new levels" (yes i also made new *.lyr files for these levels and linked them as well) i get this
ImageMap(back1ImageMap)SrcBitmap($OO) Error: 'Invalid Bitmap File!' (2)
t2dTileMap::loadTileLayer() - Could not Open File 'game/data/tilemaps/$00' for Tile-layer Load.
Unable to locate audio profile '$OO'
all the "OO" things there show up as boxes in the debug console. any help or advice would be greatly appreciated, had a blast with this tutorial and can't wait to keep going.
I also did edit the audiodatablocks file to include the new level music, I think soon here i am going to add echo statements all over around the loaduplevel function and initialize level function to see what is going wrong where, I almost wanna say it's dynamically grabbing the files and skipping over one or two and it's causing a traffic accident of some sort with the code. I am sure i pointed to the right files in the cs that i altered. I am also wondering if i delete all the *.dso files and rebuild will it solve the problem. thank you in advance and keep fighting torquesters!
09/15/2009 (3:09 pm)
Hello, awesome tutorial, and i'd like to add i too share the ball problem it usually gets lodged on the side wall from mid to top, the corner, or unbreakable blocks. I tried one of the solutions mentioned here but it didnt work for me, so just reverted back to what i had at the end of the tutoriali ran into another wall, creating levels, i modified and saved the buttons for the mainscreenGUI for levels 4 5 and 6 4 images each levelx.png .eve.x_i.png, levelx_d.png and levelx_h.png in the gui buttons folder, i modified the mainmenuGUI to make them appear and show up yet they are always "active" buttons even though inactive is set to 1.
Upon loading the "new levels" (yes i also made new *.lyr files for these levels and linked them as well) i get this
ImageMap(back1ImageMap)SrcBitmap($OO) Error: 'Invalid Bitmap File!' (2)
t2dTileMap::loadTileLayer() - Could not Open File 'game/data/tilemaps/$00' for Tile-layer Load.
Unable to locate audio profile '$OO'
all the "OO" things there show up as boxes in the debug console. any help or advice would be greatly appreciated, had a blast with this tutorial and can't wait to keep going.
I also did edit the audiodatablocks file to include the new level music, I think soon here i am going to add echo statements all over around the loaduplevel function and initialize level function to see what is going wrong where, I almost wanna say it's dynamically grabbing the files and skipping over one or two and it's causing a traffic accident of some sort with the code. I am sure i pointed to the right files in the cs that i altered. I am also wondering if i delete all the *.dso files and rebuild will it solve the problem. thank you in advance and keep fighting torquesters!
#59
I think maybe the most efficient method for the wall detection is to use the World Limit callback function.
In the script ball.cs, go to the newBall() function.
Look up the line
After this line add:
This will set up a world boundary for the ball everytime the ball is created. The ball will now bounce inside this boundary and call the onWallLimit callback function everytime it hits the boundary.
Then create a new function below the newBall function:
We need to get the ball position so we can position the wall bang effect. with $wallbang.setPosition(%point);
Scroll down to the onCollision() function and remove all this:
This code is not needed anymore because onWorldLimit is handling this now instead.
Now you can delete the 3 original "walls" in the TGB editor.
I have not found any alternative to the brick and base problem yet...
Enjoy!
09/22/2009 (10:35 pm)
AN ALTERNATIVE WALL PROBLEM UPDATEI think maybe the most efficient method for the wall detection is to use the World Limit callback function.
In the script ball.cs, go to the newBall() function.
Look up the line
... %theball.setLinearVelocity(%ballVector); %theball.setTimerOn(100);
After this line add:
%theball.setWorldLimit("bounce","-96.3 -71.3 96.3 75","true");This will set up a world boundary for the ball everytime the ball is created. The ball will now bounce inside this boundary and call the onWallLimit callback function everytime it hits the boundary.
Then create a new function below the newBall function:
function ballClass::onWorldLimit(%theball, %limitMode, %limit) {
alxPlay(wallhit);
%point = %theball.Position;
$wallbang.setPosition(%point);
$wallbang.playEffect(false);
}We need to get the ball position so we can position the wall bang effect. with $wallbang.setPosition(%point);
Scroll down to the onCollision() function and remove all this:
...
if (%dstObject.class$="wallClass") {
%dstObject.schedule(20,"makeHittable");
%dstObject.setCollisionActive(0,0);
alxPlay(wallhit);
$wallbang.setPosition(%points);
$wallbang.playEffect(false);
} else
...This code is not needed anymore because onWorldLimit is handling this now instead.
Now you can delete the 3 original "walls" in the TGB editor.
I have not found any alternative to the brick and base problem yet...
Enjoy!
#60
I think i'm experiencing same or fairly similar problem to what you guys are dealing with, possibly with a bit of a twist...
The ball, at least so far, bounces well, doesn't get stuck in the wall or bricks, BUT when the base is moving at higher speed and hits the ball, the ball get's stuck inside the base and is released again only if the base is moved aside quickly...
I'm a newbie to scripting, just started with Torque, so maybe i'm overlooking something really basic and obvious here, but if anyone has any idea how to deal with this, it'd help me a lot
.............................
Well, that's newbies for you, of course once i moved on i've realized it was corrected in the beginning of the next part of the tutorial...
10/13/2009 (7:08 am)
Great tutorial, it's a pity the parts 6 and 7 are empty...I think i'm experiencing same or fairly similar problem to what you guys are dealing with, possibly with a bit of a twist...
The ball, at least so far, bounces well, doesn't get stuck in the wall or bricks, BUT when the base is moving at higher speed and hits the ball, the ball get's stuck inside the base and is released again only if the base is moved aside quickly...
I'm a newbie to scripting, just started with Torque, so maybe i'm overlooking something really basic and obvious here, but if anyone has any idea how to deal with this, it'd help me a lot
.............................
Well, that's newbies for you, of course once i moved on i've realized it was corrected in the beginning of the next part of the tutorial...
Torque 3D Owner Ray Depew
Fortunately, it does respond correctly to mouse inputs. No errors show up in console.log.
All of my collision settings match the tutorial.
UPDATE: It's fixed!
Short version: make sure the collision polygons on the base and the shield don't overlap.
How I found it: I had implemented the "makeHittable" hack in Tutorial 3 - Miles of Tiles, and while I was testing the hack, I noticed that every time the ball hit the shield, the base jumped up out of the bottom of the screen -- to where it was supposed to be! -- for 500 milliseconds. It had to be something to do with the collision.
How to fix it:
First, edit the base's collision polygon. Select the base, then click the "Edit this objects collision polygon" icon (the first icon to the left, sitting on top of the selection box). Make the top edge of the base's collision poly a single horizontal line, from the root of one gold antenna to the root of the other. The location is very important, as you will see in the next step.You will have to move or delete some vertices to do this. Save and close.
Second, edit the shield's collision polygon. Select the shield and click the "Edit this objects collision polygon" icon. Before you start clicking on vertices, select the checkbox in the lower-right corner of the Collision Editor labeled "Display Scene Background." This adds an image of the base to the display, to give you a visual reference. Now make the bottom edge of the shield's collision poly a single horizontal line, only a few pixels above the horizontal line you just drew for the base's collision poly. You don't want any overlap, but you don't want a huge gap, either. Save and close.
When you test it, you should see that both the "base sitting low" and the "drifting slowly" problems are gone. If they're not, then recheck your collision polygons, and make sure you did the "save and close" part of it.
(Greg, I've taken screenshots of the new collision polys. See ray.datech-net.com/collision_polys.html. Feel free to swipe them and add them to your tutorial.)