This site requires JavaScript, please enable it in your browser!
Greenfoot back
Lavenger
Lavenger wrote ...

2018/4/1

Subclasses

Lavenger Lavenger

2018/4/1

#
I've noticed that I can make Subclasses under a Subclass, but the question is: How do i reference the Subclasses under a Subclass? (I just want to organise the Worlds and Actors better by a little bit by grouping them)
danpost danpost

2018/4/1

#
You cannot order them any way you like. Ordering should be by type. If you have an Animal class, then any subclass of it must be an animal, like Dog, Cat, Kangaroo,, etc. A subclass defines a more specific type of the same type object a its superclass.
Lavenger Lavenger

2018/4/1

#
danpost wrote...
You cannot order them any way you like. Ordering should be by type. If you have an Animal class, then any subclass of it must be an animal, like Dog, Cat, Kangaroo,, etc. A subclass defines a more specific type of the same type object a its superclass.
ahh, its a shame ^^" but thanks for telling me this :)
Lavenger Lavenger

2018/4/1

#
danpost wrote...
You cannot order them any way you like. Ordering should be by type. If you have an Animal class, then any subclass of it must be an animal, like Dog, Cat, Kangaroo,, etc. A subclass defines a more specific type of the same type object a its superclass.
wait, what if i were to make a type where its a minigame character, would it be viable? Example: MinigameCharacters -MiniUmaru -MiniTaihei -MiniKirie ect. Actor -Umaru -Taihei -Kirie ect. or must it be an actual type, not a made up type?
danpost danpost

2018/4/2

#
Why are you wanting to create more classes? It is probably feasible to just see what world the actor is in:
if (getWorld() instanceof MiniGame)
Do one thing if true -- or do something different if else.
Lavenger Lavenger

2018/4/2

#
danpost wrote...
Why are you wanting to create more classes?
just thought that it would be nice to see it organized xD it's slightly bugging me , thats just all ahhaha
danpost wrote...
if (getWorld() instanceof MiniGame)
Do one thing if true -- or do something different if else.
:o that's if the actor is going to be in multiple worlds right?
danpost danpost

2018/4/2

#
Lavenger wrote...
just thought that it would be nice to see it organized xD it's slightly bugging me , thats just all ahhaha{/quote] You can subclass for that -- like have a superclass for MiniGame, Players and such for categorizing or grouping. Just name them in such a way as all subclasses belong to the group or category (that objects created from subclasses are of said type).
danpost wrote...
if (getWorld() instanceof MiniGame)
Do one thing if true -- or do something different if else.
:o that's if the actor is going to be in multiple worlds right?
Yeah. I was not sure for what reason you wish to organize.
You need to login to post a reply.