Discuss Scratch

Fandris2004
New Scratcher
11 posts

ABC puzzle, coding problem

Dear network!

Currently I am working on a ABC puzzle, the idea itself is a puzzle game where you have to choose the right picture that's name starts with the shown letter of the ABC. I already have the letters imported as costumes for the letter sprite, and the pictures as different sprites into the project, I added a timer and a points system to the game. Right now I am working on the solution of showing 3 random pictures in 3 given positions, but the problem is that one of them should be the right picture that actually starts with the given letter. And I am also having a problem with the point system itself, is there a way to count points for pressing the right button indicating that it's connected to the right picture (or right position out of the 3)?

Thank you for your help and contribution in forward!
Fandris

So far the project:
https://scratch.mit.edu/projects/1117225208

Last edited by Fandris2004 (Jan. 8, 2025 00:38:19)

DragonPlusMaster
Scratcher
100+ posts

ABC puzzle, coding problem

If I'm hearing you right, you need help with the pictures randomly picking their spot out of three spots? And also once the correct button is pressed for the correct picture, the player get's points?

1:
go to x: (item (pick random (1) to (3)) of [XPos v] :: list) y: [y]
2a:
~More complicated

forever
set [keys v] to [abc]
set [p v] to [0]
repeat (length of (keys))
change [p v] by [1]
set [typed v] to (letter (p) of (keys))
if <key (typed) pressed?> then
if <(typed) = (correct)> then
change [points v] by [1]
else
Idk if you want it to subtract from the score, but here would be the place to put it :: motion
end
end
2b:
~Simple

forever
if <key (a v) pressed?> then
if <(correct) = [a]> then
change [points v] by [1]
end
end
if <key (b v) pressed?> then
if <(correct) = [b]> then
change [points v] by [1]
end
end
if <key (c v) pressed?> then
if <(correct) = [c]> then
change [points v] by [1]
end
end
end
Fandris2004
New Scratcher
11 posts

ABC puzzle, coding problem

Thank you for you answer DragonPlusMaster, this helps with the positioning of my pictures!

Also suffering a bit, with the system that a possible solution would appear, so I would try to have 1 right answer at a random position and 2 “wrong” answers so 2 different pictures shown.
How could I put it into code that three out of 26 pictures will appear and one of them will be the one starting as the Letter (or in code costume's number)?

Thanks for your or anyone's answer in forward!
Fandris

Last edited by Fandris2004 (Jan. 8, 2025 02:01:51)

Powered by DjangoBB