Initial marios style brick breaking
by Tom Feni · in Torque Game Builder · 01/26/2006 (12:38 am) · 0 replies
Well a new function is in the works,
right now I am at
the bottom function is just the dead brick call.. what should be placed after the active brick dies..
and on collision
I was trying to move the active brick up a tile(4) on hit and then do a delete on that brick, then call the brick function to place a dead brick in that location.
so right now the brick gets placed, added to a simset for saving, then waits for a colision, when a collision occurs it should move up a tad, give points, drop down, delete, and then a new dead brick gets placed.
any ideas?
TomFeni
right now I am at
// ---------------------------------------------------------------------------
// Busting bricks
// ---------------------------------------------------------------------------
function MakeBricks()
{
//createMover( position, size )
createBrick( "-24 64", "4 4" );
createBrick( "-32 64", "4 4" );
createBrick( "-40 64", "4 4" );
createBrick( "-48 64", "4 4" );
}
new SimSet( bricksSimSet );
function createBrick(%worldPos, %size)
{
%createBrick = new t2dStaticSprite(brick) { scenegraph = t2dScene; };
%createBrick.setPosition( %worldPos );
%createBrick.setSize( %size );
%createBrick.setImageMap( blockredImageMap );
%createBrick.setCollisionActive(true, true);
%createBrick.setCollisionPhysics(false, true);
%createBrick.setCollisionMaterial(standardMaterial);
%createBrick.setCollisionCallback(true);
%createBrick.setLayer($platformLayer);
%createBrick.setGroup($brickGroup);
new scriptObject(brick)
{
Brick = new t2dStaticSprite(brick) { scenegraph = t2dScene; };
position = %worldPos;
setLayer = $playerLayer;
setGroup = $brickGroup;
setImageMap = blockredImageMap;
setSize = %size;
};
bricksSimSet.add(Brick);
}
function brick()
{
%deadBrick = new t2dStaticSprite() { scenegraph = t2dScene; };
%deadBrick.setPosition( %worldPos );
%deadBrick.setSize( %size );
%deadBrick.setImageMap( blockpurpleImageMap );
%deadBrick.setCollisionActive(true, true);
%deadBrick.setCollisionPhysics(false, true);
%deadBrick.setCollisionMaterial(immovableMaterial);
%deadBrick.setCollisionCallback(true);
%deadBrick.setLayer($platformLayer);
%deadBrick.setGroup($platformGroup);
}the bottom function is just the dead brick call.. what should be placed after the active brick dies..
and on collision
function t2dSceneObject::onCollision(%srcObj, %dstObj, %srcRef,
%dstRef, %time, %normal, %contactCount, %contacts)
{
switch (%srcObj.getGroup())
{
case $playerGroup:
switch (%dstObj.getGroup())
{
case $platformGroup:
collidePlayerPlatform(%normal);
case $BrickGroup:
collidePlayerPlatform(%normal);
%dstObj.setPosition("0" SPC %position+=4);
addPlayerScore( 5 );
//%dstObj.safeDelete();
//brick();
echo ("we moving or what?");
case $starGroup:
pickup(%dstObj);
updateScores();
case $triggerGroup:
collidePlayerTrigger(%dstObj);
echo("anything happening yet");
}
}
}I was trying to move the active brick up a tile(4) on hit and then do a delete on that brick, then call the brick function to place a dead brick in that location.
so right now the brick gets placed, added to a simset for saving, then waits for a colision, when a collision occurs it should move up a tad, give points, drop down, delete, and then a new dead brick gets placed.
any ideas?
TomFeni
About the author