Static reference & Non-Static method
in
Programming Questions
•
2 years ago
Hello wise People,
I just started a very little project to learn something about processing. But i'm a bloody beginner, therefore
I don't quite understand the error-message :
Greetings
Kraabumm
I just started a very little project to learn something about processing. But i'm a bloody beginner, therefore
I don't quite understand the error-message :
I just copied a small part out of my "sourcecode", but it should be enough for you guys to see what isn't working.Cannot make a static reference to the non-static method doit(String) from the type Project.Spellcast
- String usedspell = "boom";
- void mouseClicked()
- {
- Spellcast.doit(usedspell);
- }
- class Spellcast
- {
- ArrayList spells;
- Spellcast(String usedspell)
- {
- if (usedspell == "boom")
- {
- println(usedspell);
- }
- }
- void doit(String usedspell)
- {
- spells = new ArrayList();
- spells.add(new Spellcast(usedspell));
- drawspell();
- }
- void drawspell()
- {
- for(int i=0 ; i < spells.size() ; i++)
- {
- println("Works !");
- }
- }
- }
Greetings
Kraabumm
1