Game speed
![Post Post](styles/prosilver/imageset/icon_post_target.gif)
This may not sound too advanced, but it may be a new idea to some. I have not tried doing this exactly, but I have done similar things. In some games there are settings to change the speed, to make it harder or easier. THere may also be bonuses to go slow motion. Well, it can be done. It is probably best if you start a new game, because of the editing you need to do. Create a global variable, 'gameSpeed', and set it to 1 on view's create actor. Make sure it is a real number. On all actors that are affected by speed, use draw actor to assign increases and velocity etc. So you might need a couple of actor variables, like extra velocity. A couple of examples
When you have this set up, you can adjust the speed. If you want to go at half the speed, set gameSpeed to .5, or to go at double speed, set it to 2.
You can try other values, like .25, .75, 1.5, etc. You could even make it go backwards (confusing).
- Code: Select all
if (circumstance)
{
xvelocity = xvel * gameSpeed;
}//where xvel is a variable that represents xvelocity
- Code: Select all
//for movement
if (moving)
{
switch (direction)
{
case RIGHT:
x += 5 * gameSpeed;
break;
case LEFT:
x -= 5 * gameSpeed;
break;
}
}
//for gravity
if (yvel < maxgrav)//maxgrav is the maximum gravity multiplier - if you make a variable you can adjust it when you are in water etc.
{
yvel += gravstr;
}//gravstr is the increase in gravity, you can adjust it when you want to fall at different rates, like maxgrav
yvelocity = yvel * gameSpeed;
When you have this set up, you can adjust the speed. If you want to go at half the speed, set gameSpeed to .5, or to go at double speed, set it to 2.
You can try other values, like .25, .75, 1.5, etc. You could even make it go backwards (confusing).