mini game loop ?
by ywain · in Game Design and Creative Issues · 06/04/2009 (8:11 am) · 2 replies
hi all,
im a computer games student and ive been trying to build a game using torque.
the basis is a memory game: the user is shown a sequence of lights. and the user has to then select the lights in the order that they were shown.
there are multiple levels and when the user enters the correct sequence they progress to the next level.
some code:
while(%gameActive < 1)
{
echo("while loop entered");
for(%i = 0; %i <$numberOfLevels;%i++)
{
echo("for loop entered");
loadLevel(%i);
Schedule(7000,0,getInput,"5");
//while(%lvlComplete < 1)
// {
echo("lvl complete while loop entered");
if($inputComplete < 0)
{
echo("in put complete");
compairInput(%i,$numberinlvl1);
if($count == $numberinlvl1)
{ echo("lvl complete");
%lvlComplete = 1;
$count = 0;
}
else
{echo("lvl failed");
%i = %i -1;
%lvlComplete = 1;
$count = 0;
}
}
}
}
%gameActive = 1;
}
the outer while loop is for the memory game with in the world, the memory game is only activated if the user enters a certain area of the world.
and the inner while loop is for controlling each level.(basically loops untill the user has entered a full sequence: in the case for lvl1 the sequence consists of 5 inputs)
to the point:
torque crashes every time i try to begin the game.
now after investigation i come to the conclusion torque dosent like while loops which dont have a fixed run time, so is there any other way to implement a loop(or eqiv) that will wait until the user has entered all the inputs for a sequence????
any other info plz ask.
thanks for reading my ramblings and i hope you under stand.
thanks for any help you can provide :)
im a computer games student and ive been trying to build a game using torque.
the basis is a memory game: the user is shown a sequence of lights. and the user has to then select the lights in the order that they were shown.
there are multiple levels and when the user enters the correct sequence they progress to the next level.
some code:
while(%gameActive < 1)
{
echo("while loop entered");
for(%i = 0; %i <$numberOfLevels;%i++)
{
echo("for loop entered");
loadLevel(%i);
Schedule(7000,0,getInput,"5");
//while(%lvlComplete < 1)
// {
echo("lvl complete while loop entered");
if($inputComplete < 0)
{
echo("in put complete");
compairInput(%i,$numberinlvl1);
if($count == $numberinlvl1)
{ echo("lvl complete");
%lvlComplete = 1;
$count = 0;
}
else
{echo("lvl failed");
%i = %i -1;
%lvlComplete = 1;
$count = 0;
}
}
}
}
%gameActive = 1;
}
the outer while loop is for the memory game with in the world, the memory game is only activated if the user enters a certain area of the world.
and the inner while loop is for controlling each level.(basically loops untill the user has entered a full sequence: in the case for lvl1 the sequence consists of 5 inputs)
to the point:
torque crashes every time i try to begin the game.
now after investigation i come to the conclusion torque dosent like while loops which dont have a fixed run time, so is there any other way to implement a loop(or eqiv) that will wait until the user has entered all the inputs for a sequence????
any other info plz ask.
thanks for reading my ramblings and i hope you under stand.
thanks for any help you can provide :)
#2
06/08/2009 (1:29 am)
thanks ted for the suggestion. i have managed to implement a game using your idea :)
Torque 3D Owner Ted Southard