How do you time a loading screen?

hopscotch
help

#1

I am trying to make a game in hopscotch, and at the start I want to add a loading screen to prepare all the features of the other objects in the game. But I don't know how to time the loading screen so when it finishes loading the objects in the game appear at the right time and not while it's loading, can someone tell me how to do it? Thank you


#2

Welcome to the forum @Jett1scool!
Hope you enjoy it!


#3

It is not possible to do it that way, but you can do it, just with more complecated code. I can walk you through tye steps if you wish! @Jett1scool


#4

Thanks, can you please talk me through it? I am having heaps of trouble with it


#5

Alright, you just joined, so you have limeted posts. If you have a question, hist the green square at the top to edit this post with your question! First of, what is your project and why do you want the loading screen? @Jett1scool



#6

This might be hard to understand, but

BEHOLD THE MAGIC OF VALUES!

Basically, you can make the loading screen do whatever while the game is being set up, right? Say you're doing a background. At the end of that object's rule, or whenever it's done setting up, create a value, and set that value to 1 (or any number works).
Then make a rule in the object(s) used in your loading screen. Set "When" to "When () equals ()." In the first empty space, put the value you made. In the second empty space, type the number you just set that value to. Then in the rule, you can make the loading screen turn invisible, or run away, or fade into the background, or whatever.
Hope that helps (or at least was comprehensible!)


#7

Timing as you call it, is very hard to do. Values are super fast and if you add a little more code you won't have to re-time the numbers :D

Okay, so. You need a value called "Loading" or whatever you want to call it. Then add a Ability called "Loading Complete" in that ability do this code:

Repeat Forever
    Check once if (Loading) = 1
    
    Set invisibility 0
   
    Else
  
    Set invisibility 100
    
    End
End

Add this to all the objects you want to appear after the loading screen. And on the loading screen's objects do

Repeat Forever
    Check once if (Loading) = 1
    
    Set invisibility 100
   
    Else
  
    Set invisibility 0
    
    End
End

This is the opposite of the first ability so it will be invisible when it's done loading.

Then, find the piece of code that it takes longest to run, then add a

Set Value (Loading) to 1

And that is it!
If you want anymore detail I'd be happy to help :D
It's right up my neck of the woods.


#8

Also you may wanna see THT's video on loading :wink:

Welcome btw! Tag me like "@KVJ" anytime!