Discuss Scratch

Goldrew_Amp
Scratcher
8 posts

Selecting specific variables

I am making a platformer collectathon, using clones to make the collectables, since I plan to have over 250! However, I am going to make it so you can move back and forth between areas. I have done that, but when you return to a previous area all the items respawn, instead of ones the player skipped. Is there a way to make only clones that have been uncollected reappear when a player re-enters a area? By the way, I delete all clones to prevent clones being in the next area, but I will change this if there is a better way.
Arthurtilly
Scratcher
1000+ posts

Selecting specific variables

If the player moves into a separate area, use Hide. When the layer moves back, use Show. Only use Delete Clone if the clone is collected.
Goldrew_Amp
Scratcher
8 posts

Selecting specific variables

Arthurtilly wrote:

If the player moves into a separate area, use Hide. When the layer moves back, use Show. Only use Delete Clone if the clone is collected.

Yes, but then all uncollected ones will appear when I go back. What I need is a script that makes it so that when a clone is created, it will only show in the background it was created in.
MMHMMH
Scratcher
100+ posts

Selecting specific variables

Goldrew_Amp wrote:

Arthurtilly wrote:

If the player moves into a separate area, use Hide. When the layer moves back, use Show. Only use Delete Clone if the clone is collected.

Yes, but then all uncollected ones will appear when I go back. What I need is a script that makes it so that when a clone is created, it will only show in the background it was created in.
What you will need to do is create a variable and call it ‘mylevel’. You will see a circle that says ‘for this sprite only’. Chose that, and it will make it so the variable is unique to every clone which that sprite makes, and the variable will not be shown in other sprites. For Instance if you did:
whenIstartasaclonesetmyleveltopickrandom1to10

'mylevel' would be a random number for each clone. If you were to show the ‘mylevel’ variable, it would be shown as zero because its showing the ‘mylevel’ for the sprite, not for it's clones.

Hopefully that makes sense, or maybe you already knew that. Anyway, what you would do is something like:
whenIstartasaclonesetmyleveltolevelforeveriflevel=mylevelthenshowelsehide
which would make it so whenever it is the level in which it was created, it will show itself.

Last edited by MMHMMH (Feb. 8, 2015 03:47:19)

Goldrew_Amp
Scratcher
8 posts

Selecting specific variables

Yah, I didn't know that there was an option for only specific clones. Thanks!
MMHMMH
Scratcher
100+ posts

Selecting specific variables

Goldrew_Amp wrote:

Yah, I didn't know that there was an option for only specific clones. Thanks!
No problem!
Goldrew_Amp
Scratcher
8 posts

Selecting specific variables

MMHMMH wrote:

Goldrew_Amp wrote:

Yah, I didn't know that there was an option for only specific clones. Thanks!
No problem!

Sorry. This is my fault. This doesn't work. To make it more clear, what I am doing is that I have 5 clones that are collectable. If you head to the next screen but miss one, you can move to the left and try to get it again. However, if you go back to the left, all clones respawn, not just ones that weren't collected. Making this clear. I do not mean a scrolling level. I mean a level where the screen edges continue to the next area. Again, sorry for pre-maturly saying it worked.
deck26
Scratcher
1000+ posts

Selecting specific variables

As long as each clone has a variable to say whether it has been collected or not you know whether or not to show it when other conditions are right. Shouldn't be a problem.
Goldrew_Amp
Scratcher
8 posts

Selecting specific variables

deck26 wrote:

As long as each clone has a variable to say whether it has been collected or not you know whether or not to show it when other conditions are right. Shouldn't be a problem.

I would do this, but unfortunately, I will have many clones, and this many variables would take up a lot of space.
deck26
Scratcher
1000+ posts

Selecting specific variables

Goldrew_Amp wrote:

deck26 wrote:

As long as each clone has a variable to say whether it has been collected or not you know whether or not to show it when other conditions are right. Shouldn't be a problem.

I would do this, but unfortunately, I will have many clones, and this many variables would take up a lot of space.
There shouldn't be a problem with a clone having a local variable like this. It's quite normal for clones to have one or two values so I don't know why you think it's a problem.
Goldrew_Amp
Scratcher
8 posts

Selecting specific variables

deck26 wrote:

Goldrew_Amp wrote:

deck26 wrote:

As long as each clone has a variable to say whether it has been collected or not you know whether or not to show it when other conditions are right. Shouldn't be a problem.

I would do this, but unfortunately, I will have many clones, and this many variables would take up a lot of space.
There shouldn't be a problem with a clone having a local variable like this. It's quite normal for clones to have one or two values so I don't know why you think it's a problem.

I just misunderstood you, sorry.

Powered by DjangoBB