Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Fixing bugs
- Periodic_Videos
-
Scratcher
56 posts
Fixing bugs
I'm working on this project (https://turbowarp.org/672676293/editor) and it has quite a lot of bugs. I'm annoyed with these bugs for a long time already. Or I've just code something wrong…
Bug 1: You can fish by pressing enter key without touching the lake. I want it to start fishing only when touching the lake.
Bug 2: When you've unlocked lake 2 and 3, you can fish multiple sprites at a time. For example, you're touching lake 2, but you tend to also fish in lake 1 and you got more money than expected.
Bug 3: The “Times fishing” variable doesn't change value at all.
I hope this could be easy to fix. Thanks a lot if you could help me!
Bug 1: You can fish by pressing enter key without touching the lake. I want it to start fishing only when touching the lake.
Bug 2: When you've unlocked lake 2 and 3, you can fish multiple sprites at a time. For example, you're touching lake 2, but you tend to also fish in lake 1 and you got more money than expected.
Bug 3: The “Times fishing” variable doesn't change value at all.
I hope this could be easy to fix. Thanks a lot if you could help me!
- KaaBEL_sk
-
Scratcher
100+ posts
Fixing bugs
1. You have:
3. Use lists or other way instead of tons of broadcasts and then if blocks.
repeat until <key [enter v] pressed?>and then Fish here loops forever → always when enter pressed it fishes:
if <touching [player v] ?> then
broadcast [Fish here v]
end
if <(Times fishing) > (1)> then
broadcast [Fish here v]
end
end
when I receive [Fish here v]2. Asking for the time at the start is very uncertain. First time I answered 5 i worked, but later tried 300, 8, and didn't work. (Im gonna add example)
go to [front v] layer :: looks
forever
...
end
3. Use lists or other way instead of tons of broadcasts and then if blocks.
- Periodic_Videos
-
Scratcher
56 posts
Fixing bugs
1. You have:Helpful! Thanks!repeat until <key [enter v] pressed?>and then Fish here loops forever → always when enter pressed it fishes:
if <touching [player v] ?> then
broadcast [Fish here v]
end
if <(Times fishing) > (1)> then
broadcast [Fish here v]
end
endwhen I receive [Fish here v]2. Asking for the time at the start is very uncertain. First time I answered 5 i worked, but later tried 300, 8, and didn't work. (Im gonna add example)
go to [front v] layer :: looks
forever
...
end
3. Use lists or other way instead of tons of broadcasts and then if blocks.
- KaaBEL_sk
-
Scratcher
100+ posts
Fixing bugs
set [Timer v] to (0)But I think you want it to be that player choose from one of the game time and he tries than to earn as much as possible (speedrun competiting) then I would suggest using button options.
repeat until <(Timer :: variables) > (0)>
if <<not <((answer) + (1)) = (1)>> or <(answer) = (0)>> then // my way to detect number
set [Timer v] to ((answer) * (60))
else
ask [Write number only! How long do you want to play?] and wait
end
end
Edit! : timer in repeat until was ment to be variable Timer
Last edited by KaaBEL_sk (April 9, 2022 10:23:00)
- Periodic_Videos
-
Scratcher
56 posts
Fixing bugs
Oh OK thanks I gonna see if it worksset [timer v] to (0)But I think you want it to be that player choose from one of the game time and he tries than to earn as much as possible (speedrun competiting) then I would suggest using button options.
repeat until <(timer) > (0)>
if <<not <((answer) + (1)) = (1)>> or <(answer) = (0)>> then // my way to detect number
set [timer v] to ((answer) * (60))
else
ask [Write number only! How long do you want to play?] and wait
end
end
- Juliur
-
Scratcher
9 posts
Fixing bugs
if <<touching color > and <not <touching color >
>
Fish
<touching [ v] ?>end
Last edited by Juliur (April 10, 2022 07:58:33)
- Juliur
-
Scratcher
9 posts
Fixing bugs
when green flag clicked
forever
if <<touching color [#105723] ?> and <<not ><touching color [#105723] ?>> then
Fish
end
end
Last edited by Juliur (April 10, 2022 08:03:27)
- Periodic_Videos
-
Scratcher
56 posts
Fixing bugs
Hmmm… I'm also thinking of that. Thanks for the help!when green flag clicked
forever
if <<touching color [#105723] ?> and <<not ><touching color [#105723] ?>> then
Fish
end
end
- Juliur
-
Scratcher
9 posts
Fixing bugs
when green flag clicked
forever
if <<touching color [blue] ?>and<not<touching color [green]>>> then
Fish
end
I think it work so!
- Periodic_Videos
-
Scratcher
56 posts
Fixing bugs
HhheeellllpppPlease don't necropost (reviving dead forums)
also help? on what?
- Discussion Forums
- » Help with Scripts
-
» Fixing bugs
