Discuss Scratch

cs638364
Scratcher
1 post

What am I Doing Wrong?

Here is the project in question…
So if you look in the scripts, I have scripted each animal, when clicked, to change the backdrop to the animal that has been clicked. (I haven't coded them to disappear yet, except for the orange dog) I was wondering if you guys had any tips of what to do (and quite frankly everything else), since I still consider myself quite new to coding. Especially about how to make each of the sprites disappear after another is clicked without overusing the
when backdrop switches to [ dog v]      
hide
when backdrop switches to [ cat v]
hide
etc., over and over again for each sprite and for each background.

Also, if you could tell me exactly what
define 
^ that is for, it would help a ton. I only understand the gist of what it does and do not understand what it is fully capable of.
Thanks for actually reading this
PikaPal54
Scratcher
100+ posts

What am I Doing Wrong?

You could try something like this (example is for the ‘cat’ sprite):
when I receive [Hide v]
hide
if <(backdrop name) = [cat]> then
show
end
And for the dog, you could try this:
when I receive [Hide v]
hide
if <(backdrop name) = [dog]> then
show
end
Just repeat that for every sprite/backdrop, and it should work.

Also, think of custom blocks (define { }) as sprite specific broadcasts, with the option to run without screen refresh, which is VERY useful.

Last edited by PikaPal54 (May 28, 2017 05:15:29)




Precision Panic: Dodge the obstacles by moving your mouse! 5 difficult levels await you!
Bitcoin Clicker: Click a coin! Become a bitcoinaire!
Duck Life: Train your duck for races by playing minigames! Based off the popular flash game!


Galleigo
Scratcher
500+ posts

What am I Doing Wrong?

Custom blocks are like a function packed into a single block… you can use them to do stuff like split a whole script into different parts with different variables.

One use is that you can set a single parameter in a custom block and then make the script that defines the custom block refer to the parameter. This way, you can adjust all of the numbers (and thus what your custom block does) with a single block.

Also, above comment should work…

Last edited by Galleigo (May 29, 2017 07:42:17)


((╯°□°)–︻╦╤─ – – – :: sensing) :: pen cap
Blocky, a young guard block, guards my signature from kumquats. Still trying to teach him how to shoot the kumquat instead of my signature. By the way, all these coloured URLs still work. Cool, huh? (Sorry for the insane bolding, italicising and underlining. :P)
CYBERSPHERE. They keep coming. It never ends. Can't stop. Won't stop.
My shop is here. Go check it out!
BEAT. How fast are your reflexes?
Space Debris.Tiny floating colourful particles. Nothing much.
Do YOU want to rule? Let's discuss the Rules for Rulers.
Interested in space? Check out The Solar System - Our Home in Space. I was too lazy to colour that one.
ORBIT. Dodge everything to survive!

Powered by DjangoBB