Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Help needed with simple game
- grade7sts
- Scratcher
5 posts
Help needed with simple game
Hello,
We are looking for help with a “where is the apple” game.
The object of the game is to guess which present the apple is hiding behind. Right now, the apple is always hiding behind the same present. We would like it to hide behind a random present. Any help would be HUGELY appreciated!
For example, can you randomize the coordinates between three different positions?
Should we have three apples that randomly show and hide?
Could it be done with costumes?
https://scratch.mit.edu/projects/162108097/
We are looking for help with a “where is the apple” game.
The object of the game is to guess which present the apple is hiding behind. Right now, the apple is always hiding behind the same present. We would like it to hide behind a random present. Any help would be HUGELY appreciated!
For example, can you randomize the coordinates between three different positions?
Should we have three apples that randomly show and hide?
Could it be done with costumes?
https://scratch.mit.edu/projects/162108097/
- DominoDragon1
- Scratcher
1000+ posts
Help needed with simple game
Use this:
set [random v] to (pick random (1) to (3))Put the appropriate values to move to the right location.
if <(random) = [1]> then
go to x: (0) y: (0)
else
if <(random) = [2]> then
go to x: (0) y: (0)
else
Etc.
end
end
There are 10 kinds of people in the world, those who know binary and those who don't. “And those who think they do but are still waiting on 8 more people.” (Sigton).
- rpglurker
- Scratcher
100+ posts
Help needed with simple game
the best way is to store your coordinates in a list (or lists if you prefer)….
for example xlist contains 100, -98, 22 ylist contains 0, 40, -45
pick a random number between 1 and length of your list(s)… say 2 is our random answer
item 2 of xlist has your x coordinate and item 2 of ylist has your y coordinate…
Now just put your package at this location…
This way you can have as many items as you need in your list
for example xlist contains 100, -98, 22 ylist contains 0, 40, -45
pick a random number between 1 and length of your list(s)… say 2 is our random answer
item 2 of xlist has your x coordinate and item 2 of ylist has your y coordinate…
Now just put your package at this location…
This way you can have as many items as you need in your list
Last edited by rpglurker (May 19, 2017 20:38:26)
Retired Microsoft Software Manager Turned CS Teacher
“Education is the most powerful weapon which you can use to change the world.” - Nelson MandelaChanging the world one CS student at a time!!!
- grade7sts
- Scratcher
5 posts
Help needed with simple game
Thank you! Awesome suggestions. The ‘List’ is new to me, but will be a great tool.
- asivi
- Scratcher
1000+ posts
Help needed with simple game
Also you can store Sprite' names in a list and, well, take a look https://scratch.mit.edu/projects/161734865/
- Discussion Forums
- » Help with Scripts
- » Help needed with simple game