Discuss Scratch

littlekitty5
Scratcher
18 posts

Buggy "Go To" Scripts?

I'm making a game in which you are a koi fish who swims around a small pond (no scrolling). In the game, the temperature will routinely drop, and before the temperatures reach detrimental levels a sweater will appear on screen. When you get to it, the sweater sprite follows the koi fish around (so that it looks like your fish is wearing the sweater) until the temperature rises again.

This works fine. I actually encountered a glitch where restarting the game (by clicking a button sprite, not by hitting the green flag) would suddenly cause the sweater to lag slightly behind the fish, even when the fish was completely still. I couldn't figure out why it was doing this, but did narrow the problem down to the
go to [koi]
block. For some reason, having the other scripts in the sprite stop whenever the game was over fixed this glitch, and now the sweater works fine.

BUT I also added a store to my game, with outfits you can buy your fish. I used the same scripts for the “go to” function as the sweater, even adding the “stop other scripts in sprite” script for luck, but it doesn't work at all. I thought maybe it was just an issue with the block itself (as I've encountered problems with this block in other games—like my “Afternoon Tea” game, which worked fine until I put it in 2.0, and the only issues involve “go to” blocks) so I created some variables and replaced the “go to koi” block with a
go to x: (koi x) y: (koi y)
block in the hope that it would be less buggy. But it wasn't. Using the new block worked fine for the sweater (???) but still doesn't work at all for the outfits.

The outfits rotate fine, but they lag behind the sprite, even though I was careful to draw their costumes over top the actual koi fish explicitly so that there wouldn't be any issues in that regard. I even exchanged the sweater's costume with some of the outfits and they worked PERFECTLY inside the sweater sprite. I'm baffled? I'm thinking of just merging the sweater and costume sprites since the sweater seems to work fine now, but I would like to know if other people are having similar problems with these blocks and if there's anything I can do to fix it, as this problem is recurring across my 2.0 projects.
littlekitty5
Scratcher
18 posts

Buggy "Go To" Scripts?

Lmao ok nvm I think the problem may have been that my outfits were 100% in size whereas the koi fish and the sweater were 70% in size X'D augh, I'd completely forgotten I'd had to resize them!

NOPE IT STILL VERY MUCH DOES NOT WORK

Successfully merged the sweater and outfits together anyway, though

Last edited by littlekitty5 (May 17, 2018 22:10:48)

Despicable_Dad
Scratcher
500+ posts

Buggy "Go To" Scripts?

littlekitty5 wrote:

but they lag behind the sprite,

I know this isn't what you actually asked, but I wondered if you'd thought of having the fish sprite switch to a costume *of a fish in a sweater* which would mean you didn't have to worry about making another sprite follow it around.

Apologies if I've misunderstood what you're trying to achieve.




I'm a Scratch Wiki contributor, and always keen to know which bits of the wiki are unclear. If I can, I'll try to improve things; otherwise, I'll make sure it's brought to the attention of someone who actually knows what they're talking about.
if <not <touching color [#3d4fe4] ?>> then
return true anyway cos computers are vague, innit
change [scratchFoibles v] by (1)
end
if <[a] = [A]> then
think [What???]
change [scratchFoibles v] by (1)
end



littlekitty5
Scratcher
18 posts

Buggy "Go To" Scripts?

Despicable_Dad wrote:

littlekitty5 wrote:

but they lag behind the sprite,

I know this isn't what you actually asked, but I wondered if you'd thought of having the fish sprite switch to a costume *of a fish in a sweater* which would mean you didn't have to worry about making another sprite follow it around.

Apologies if I've misunderstood what you're trying to achieve.

I have the fish run a swimming animation with 6 frames and didn't want to have to edit 6 new costumes to add a sweater, 6 more for a cowboy outfit, 6 more for a suit outfit, etc. etc. : P I thought it would be much simpler just to have the outfit follow the fish, especially because the 2.0 paint editor can get really wonky when you try and edit costumes using selections, imported art, and copy & paste functions in bitmap mode.
deck26
Scratcher
1000+ posts

Buggy "Go To" Scripts?

Suspect this is the common problem where you're not properly controlling the order of when things happen. You need to make sure, within one frame, that you move the fish and then the sweater and it can't happen the other way round.
littlekitty5
Scratcher
18 posts

Buggy "Go To" Scripts?

deck26 wrote:

Suspect this is the common problem where you're not properly controlling the order of when things happen. You need to make sure, within one frame, that you move the fish and then the sweater and it can't happen the other way round.

All right, I get it now! Thanks. : D With this in mind, I was able to fix the glitch!

Powered by DjangoBB