FluffyPapes
12-24-2008, 07:11 AM
Alright, so I'm making an RPG [shocker?]
Anyways, so as you know, in an RPG, there has to be collisions... like a bajillion of them. So, the first collision is with a wall, [no way ?].
So, my first problem was thinking of how to work the collision. Okay, so, I did this:
if(this.hitTest(_root.wall1))
{
walkSpeed = 0;
runSpeed = 0;
}
So, it got the job done. At least until I wanted to move again. So, I set an else statement so it then looked like
if(this.hitTest(_root.wall1))
{
walkSpeed = 0;
runSpeed = 0;
}else{
walkSpeed = 5;
runSpeed = 8;
}
However, the problem I see is now it's ALWAYS set to 5 walking and 8 running.
What if I try to change it later cause you know, with stats, maybe every 1 stat adds like .2 speed to walking and .3 to running? I don't know yet, but I do know that when I try to change the value, that value is still static.
Any ideas?
Edit:
Also, as for the glitche(s):
I noticed something that was probably not supposed to happen.
I decided to press the Up arrow key while hugging the wall while going sideways. By doing this, it got the player's head going straight through the wall and the player became stuck in an endless loop of collisionness making it constant walkSpeed/runSpeed of 0.
Also any ideas to fix that as well?
Anyways, so as you know, in an RPG, there has to be collisions... like a bajillion of them. So, the first collision is with a wall, [no way ?].
So, my first problem was thinking of how to work the collision. Okay, so, I did this:
if(this.hitTest(_root.wall1))
{
walkSpeed = 0;
runSpeed = 0;
}
So, it got the job done. At least until I wanted to move again. So, I set an else statement so it then looked like
if(this.hitTest(_root.wall1))
{
walkSpeed = 0;
runSpeed = 0;
}else{
walkSpeed = 5;
runSpeed = 8;
}
However, the problem I see is now it's ALWAYS set to 5 walking and 8 running.
What if I try to change it later cause you know, with stats, maybe every 1 stat adds like .2 speed to walking and .3 to running? I don't know yet, but I do know that when I try to change the value, that value is still static.
Any ideas?
Edit:
Also, as for the glitche(s):
I noticed something that was probably not supposed to happen.
I decided to press the Up arrow key while hugging the wall while going sideways. By doing this, it got the player's head going straight through the wall and the player became stuck in an endless loop of collisionness making it constant walkSpeed/runSpeed of 0.
Also any ideas to fix that as well?