Guitar hero like game problem.
Posted: Sun Jul 29, 2012 7:40 pm
Hi, i'm trying to make a guitar hero like game and run into this problem that couldn't solve:
I create an actor with a pseudo random symbol that moves in certain direction towards a goal like this:
----- . . . . . . . . . . . . . . -----. . .II
| -> | . . . . . . . . . . . . . |.....|. . .II
----- . . . . . . . . . . . . . . -----. . .II
new actor-----------------------goal----end line
When the created actor reaches the goal, you have to press the key corresponding to the appropriate symbol and if, it reaches the end line before doing so, you missed it.
For the end line, i'm using GE collision detection, so no problem there, but for the goal, i'm using a script like this (pseudocode):
if (newActor.name == keyPressed.name) && (newActor.xprevious > (goal.x - 20)) ) {
DestroyActor(newActor);
doSomeEffectsAndScoreStuff();
}
The problem is in the "(newActor.xprevious > (goal.x - 20))" part. For some reason, depending on the speed of the new actor, it is virtually impossible to get this script to work, is like there is a difference between what the user sees on the screen and whats going on in the model, so when you see that the new actor is on the goal and press the key, you just missed it.
Is this a GE limitation or i'm doing something wrong?
Thanks in advance.
I create an actor with a pseudo random symbol that moves in certain direction towards a goal like this:
----- . . . . . . . . . . . . . . -----. . .II
| -> | . . . . . . . . . . . . . |.....|. . .II
----- . . . . . . . . . . . . . . -----. . .II
new actor-----------------------goal----end line
When the created actor reaches the goal, you have to press the key corresponding to the appropriate symbol and if, it reaches the end line before doing so, you missed it.
For the end line, i'm using GE collision detection, so no problem there, but for the goal, i'm using a script like this (pseudocode):
if (newActor.name == keyPressed.name) && (newActor.xprevious > (goal.x - 20)) ) {
DestroyActor(newActor);
doSomeEffectsAndScoreStuff();
}
The problem is in the "(newActor.xprevious > (goal.x - 20))" part. For some reason, depending on the speed of the new actor, it is virtually impossible to get this script to work, is like there is a difference between what the user sees on the screen and whats going on in the model, so when you see that the new actor is on the goal and press the key, you just missed it.
Is this a GE limitation or i'm doing something wrong?
Thanks in advance.