Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Random sprite picker system
- ALITTARY
-
Scratcher
40 posts
Random sprite picker system
I am making an educational game that puts you in a small room where a question shows up on the floor and you have to go through a door with a number on it to answer it. Being that kind of game I made the questions randomize by using the block (pick random)
-What I don't want is them being assigned to change based on what costume the question is on because then people would be able to predict their movement automatically based on the numbers shown and easily avoid the enemy.
-What I Can't do is use the pick random code or at least not in the way that I intend as it only picks and randomizes things within the sprite but cannot choose what sprite, Meaning I would have to do some sort of squishing all the enemy characters into one sprite and putting all their coding and costumes into that sprite. I don't think that would go well but then again maybe I'm just overthinking it.
-What I do want Is a system that can pick between 6 sprites which one to activate and do it randomly
I didn't post a link to the game because I do not want this to seem like an advertisement although If you do need one you can ask me.
I do not think a link is necessary though because what I need is pretty simple and I don't really think the randomizer coding would be all that affected by my coding.
I basically just need a sprite picker system that chooses a sprite randomly, Although not a character select more like a randomized enemy select that does it behind the scenes basically spawning a randomized enemy each time.
(pick random (1) to (30))The randomizer button would choose a certain number and the sprite would switch to that numbered costume. The two other sprites for the answers and wrong answers would be matched with the questions sprite using an
if (Question = 1) thenThat insures that whatever costume the questions are on would be matched with the corresponding answers sensing what costume its on and changes to the matching one. that system however wouldn't work for my enemies sprites as they are meant to be randomly chosen each time, not paired with a certain Question. The only reason I got questions to be chosen randomly was using the pick random block to pick a number and change the costume. Then for the answers they didn't change randomly they just switched to match the questions. The enemies I made are about 6 separate sprites with similar action coding but I have no way of figuring out how I should make them get chosen and do their jobs blocking the player from the answer. Whenever the player does eventually get the answer and the question changes and the player is sent back to the start,the enemy should also change and switch to a random enemy with a different set of movement.
switch costume to [ A1]end
-What I don't want is them being assigned to change based on what costume the question is on because then people would be able to predict their movement automatically based on the numbers shown and easily avoid the enemy.
-What I Can't do is use the pick random code or at least not in the way that I intend as it only picks and randomizes things within the sprite but cannot choose what sprite, Meaning I would have to do some sort of squishing all the enemy characters into one sprite and putting all their coding and costumes into that sprite. I don't think that would go well but then again maybe I'm just overthinking it.
-What I do want Is a system that can pick between 6 sprites which one to activate and do it randomly
I didn't post a link to the game because I do not want this to seem like an advertisement although If you do need one you can ask me.
I do not think a link is necessary though because what I need is pretty simple and I don't really think the randomizer coding would be all that affected by my coding.
I basically just need a sprite picker system that chooses a sprite randomly, Although not a character select more like a randomized enemy select that does it behind the scenes basically spawning a randomized enemy each time.
Last edited by ALITTARY (Aug. 11, 2020 15:32:54)
- cs2925723
-
Scratcher
100+ posts
Random sprite picker system
Perhaps you should add messages numbered 1-(however many types there are), and then do the code
broadcast (pick random (1) to [(however many types there are)])and then do the code
when I receive [1 v]
...
when I receive [2 v]
...
//And so on.
- ALITTARY
-
Scratcher
40 posts
Random sprite picker system
Perhaps you should add messages numbered 1-(however many types there are), and then do the codeInteresting I will try out this method, thank you very much!broadcast (pick random (1) to [(however many types there are)])and then do the codewhen I receive [1 v]
...
when I receive [2 v]
...
//And so on.
- ALITTARY
-
Scratcher
40 posts
Random sprite picker system
Perhaps you should add messages numbered 1-(however many types there are), and then do the codeI have used the code you provided modified it a bit and it worked, Thanks for helping!broadcast (pick random (1) to [(however many types there are)])and then do the codewhen I receive [1 v]
...
when I receive [2 v]
...
//And so on.
- Discussion Forums
- » Help with Scripts
-
» Random sprite picker system