Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Saving A Pick Random Without a Variable
- -TheLoop-
- Scratcher
2 posts
Saving A Pick Random Without a Variable
How do I saved a Pick Random value without using a variable? I'm making a scrolling background game that you can move around, and I'm trying to generate trees. All trees are supposed to be made from clones of the original tree, so I'm trying to make the tree go to the x and y of the scrolling background + a pick random. But since it's cloned, I can't use variables and I'm stuck.
Code:
when I start as clone
{
show();
repeat until (quitGame = true)
{
set x to (xposition of world) + x
set y to (yposition of world) + y
}
}
That is the code, it's not JavaScript or anything, but hopefully someone helps.
Code:
when I start as clone
{
show();
repeat until (quitGame = true)
{
set x to (xposition of world) + x
set y to (yposition of world) + y
}
}
That is the code, it's not JavaScript or anything, but hopefully someone helps.
- -TheLoop-
- Scratcher
2 posts
Saving A Pick Random Without a Variable
That can work, but I'm using 20 just as an example. It's going to be like -100 to 100 or more, and I can't fill out each if statement. Sorry for the confusion.
- Eagle138
- Scratcher
500+ posts
Saving A Pick Random Without a Variable
You could use the clone id variable trick if you want each clone to have its own id… Just make a variable, set it to ‘for this sprite only’, and change it by 1 each time you make a clone, and each clone will have its own variable. It can be a bit finnicky to set up, but you can ask me for more details if it isn't working. Hope this helps
~ Eagle38
coder/artist/noob animator :: he/they :: unconventional :: comment ‘e’ on my profile if you see this
just call me Eagle
fancy signature banner coming…one day
- Discussion Forums
- » Help with Scripts
- » Saving A Pick Random Without a Variable