Discuss Scratch

k8animation
Scratcher
5 posts

Suggestion - Instance Variables

Could it be possible to add a feature that creates a new variable for a clone of a sprite? This variable would have to be created when a clone is created and have a specific ID? This variable would be deleted at the same time as the clone it would be connected to was deleted. This would make games with multiple NPC's easier to create and manage
beckerb4
Scratcher
12 posts

Suggestion - Instance Variables

I agree that there needs to be a way to reference sprites after they have been created. Not sure of the best way to do it though.
Either they need a name, or we need the ability to add sprites to lists.
k8animation
Scratcher
5 posts

Suggestion - Instance Variables

beckerb4 wrote:

I agree that there needs to be a way to reference sprites after they have been created. Not sure of the best way to do it though.
Either they need a name, or we need the ability to add sprites to lists.
yeah
Hardmath123
Scratcher
1000+ posts

Suggestion - Instance Variables

Use the “for this sprite only” option.
k8animation
Scratcher
5 posts

Suggestion - Instance Variables

Hardmath123 wrote:

Use the “for this sprite only” option.
that will effect the sprite and all of its clones… i'm looking for something that makes individual variables for each clone, hence the term instance variables
blob8108
Scratcher
1000+ posts

Suggestion - Instance Variables

Hardmath has a point — each clone already gets its own copy of the sprite's variables. What can't you do with the way it works currently?

tosh · slowly becoming a grown-up adult and very confused about it
k8animation
Scratcher
5 posts

Suggestion - Instance Variables

blob8108 wrote:

Hardmath has a point — each clone already gets its own copy of the sprite's variables. What can't you do with the way it works currently?
I was unaware of that, and im not completely sure how to do that
lalala3
Scratcher
100+ posts

Suggestion - Instance Variables

k8animation wrote:

blob8108 wrote:

Hardmath has a point — each clone already gets its own copy of the sprite's variables. What can't you do with the way it works currently?
I was unaware of that, and im not completely sure how to do that
1. Add a global variable. Set it to 0.
2. When you make a new clone, have it assign its ID variable to the global variable, and then increment the global variable.

Done.

Last edited by lalala3 (Feb. 25, 2013 23:33:17)


Powered by DjangoBB