I am just wondering how to make obstacles randomly generate like Toasty's Adventure.
How??
Thx if you help,
Josh
Offline
when gf clicked//this goes in the obstacle set x to(pick random (whatever the smallest number the x position can be is) to (whatever the largest number x position can be is))then do the same for the y position.
Offline
How do you get the variable?
Jsohamunga
Offline
joshamunga wrote:
How do you get the variable?
Jsohamunga
They aren't supposed to be variables. Just read the "variables" and insert numbers for them. For example, you might use this:
when gf clicked//this goes in the obstacle set x to(pick random (-180) to (180))
Offline
ErnieParke wrote:
joshamunga wrote:
How do you get the variable?
JsohamungaThey aren't supposed to be variables. Just read the "variables" and insert numbers for them. For example, you might use this:
when gf clicked//this goes in the obstacle set x to(pick random (-180) to (180))
I'm also working on creating random obstacles How do you automate it to have the objects generated randomly throughout the game instead of when the the gf is clicked?
Offline
Unforgivableblack wrote:
ErnieParke wrote:
joshamunga wrote:
How do you get the variable?
JsohamungaThey aren't supposed to be variables. Just read the "variables" and insert numbers for them. For example, you might use this:
when gf clicked//this goes in the obstacle set x to(pick random (-180) to (180))I'm also working on creating random obstacles How do you automate it to have the objects generated randomly throughout the game instead of when the the gf is clicked?
To automate it, just run the set x part of the script whenever you need to. For example, you might use:
when gf clicked forever if (touching [edge v]?) set x to (pick random (-180) to (180)) endI hope that this answers your question!
Offline
ErnieParke wrote:
Unforgivableblack wrote:
ErnieParke wrote:
They aren't supposed to be variables. Just read the "variables" and insert numbers for them. For example, you might use this:when gf clicked//this goes in the obstacle set x to(pick random (-180) to (180))I'm also working on creating random obstacles How do you automate it to have the objects generated randomly throughout the game instead of when the the gf is clicked?
To automate it, just run the set x part of the script whenever you need to. For example, you might use:
when gf clicked forever if (touching [edge v]?) set x to (pick random (-180) to (180)) endI hope that this answers your question!
thanks that definitely answered my question. the only problem i'm running into is that the sprite randomly appears incredibly fast. is there how would i slow it down?
Offline
Do you have any other code that controls the movement or speed of the obstacles? The code ErniePark changes the obstacle's position when it touches the edge, or when the project starts.
Offline