Discuss Scratch

iGPR3
Scratcher
3 posts

Code wont work?

Hi there, i'm using turbowarp to run wordle in scratch, but my code seems fine and theres a big issue with it. The code tells the letter I want to move the box thats selected, the letter it needs to switch to in costumes, and then creates a clone. When that clone spawns, its set to go to a ‘letter x’ and ‘letter y’ location on the screen. A separate sprite detects which box is selected, and then sets the x and y variables accordingly. For some reason, the code doesnt put the sprite in the correct spot, and also adds a lot of letters to my ‘guessed letters’ list, eventually crashing the game. Any help would be great.

Link: https://turbowarp.org/739117021/fullscreen?fps=60&clones=Infinity&offscreen&limitless&hqpen&size=630x360
Redclopez_test
Scratcher
2 posts

Code wont work?

one problem with your code is that the letters skip easily, but the main problem is the clones are responding to the letter presses too. what I mean is the selected box changes too rapidly because each time you make a new clone, it copies those actions, so you first skip by 1, then 2, then 3, then 4 and so on. To fix that, add under the when I start as clone, set (new this sprite only variable) id to 1. Furthermore, if the current box gets greater than 4, you want to set it back. so use an if-then block to fix that and use another variable for the row. For a simpler letter placement script use the one below this script below. Hope this helps. Take a look at this link to see for yourself: https://scratch.mit.edu/projects/739495281/
forever
if <(selected box)>(4)> then
set [selected box v] to (0)
change [selected row v] by (1)
end
when green flag clicked
forever
set [next letter x v] to ((-70)+((selected box)*(35)))
set [next letter y v] to ((146)-((selected row)*(35)))
end
when I start as a clone
set [id v] to (1)

when [a v] key pressed
if <(id)=(0)> then
...
Redclopez_test
Scratcher
2 posts

Code wont work?

if it works, could you credit me or follow me or something as payment? thx
Redclopez
Scratcher
19 posts

Code wont work?

This is my main account, just to let you know

Powered by DjangoBB