• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Android Speed Up Time

C

Chatterb0x

Guest
Hello,
The breakout-style genre has been trending on mobile. I'm developing a variation and intend to share results with GM Community. These games often have fast-forward buttons for when the ball takes 'too long'. One can replicate the effect by increasing room speed on PC. Unfortunately, Android (and iOS, probably) can't process anything faster than 60 steps per second. Increasing speed puts balls at risk of exceeding boundaries, though countermeasures are in place.

What is the best method?
 

YellowAfterlife

ᴏɴʟɪɴᴇ ᴍᴜʟᴛɪᴘʟᴀʏᴇʀ
Forum Staff
Moderator
If you organize the game logic (ball movement, paddle movement, etc.) to occur entirely from a script call such as
Code:
/// scr_advance()
with (obj_ball) scr_ball_step();
with (obj_paddle) scr_paddle_step();
// ...
to speed up time you would call it more than once per step. This also makes pausing easier (as you can just not call the script).
Does require some code changes (using place_meeting\collision_ functions and with-loops instead of collision events), however.
 
C

Chatterb0x

Guest
Essentially, the script would move the ball a certain number of pixels each time called, correct?
 
C

Chatterb0x

Guest
I have astoundingly found a solution involving ball speed and am not entirely sure why it works. Update shortly.

UPDATE:
It has to do with my collision detection code. I forgot that speed is set every Step Event.
Code:
//obj_ball
//Collision detection.
                   if(distance_to_object(obj_wall) < 20){
                   speed = 10;
                   move_contact_solid(direction,1);
                   }else if((distance_to_object(obj_floor) < 40 ) &&
                   (direction >= 180 && direction < 360)){
                   speed = 10;
                   }else{
                   speed = 20;
                   }
When the player holds Fast Forward, it doubles speed set in the prior instance (Mistakenly thought speed was coded to be set at one time). Releasing Fast Forward doesn't multiply the speed. There appear to be no collision issues.
 
Last edited by a moderator:

sp202

Member
"Appear" is the right word, chances are something will crop up. I don't recommend changing speed without accounting for it with changes to collision.
 
C

Chatterb0x

Guest
"Appear" is the right word, chances are something will crop up. I don't recommend changing speed without accounting for it with changes to collision.
:-( It's a matter of time.
 
Top