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

2013/6/14

How to make a value available in multiple classes

tom1895 tom1895

2013/6/14

#
Basically, whenever I have my object "jump" (player hits the up arrow) I add 1 to an integer "level." I want to use this int in another class in the form of if(level>10) { //perform some action } However, I get the error "cannot find symbol - variable level" Does anyone know what to do about this?
Gevater_Tod4711 Gevater_Tod4711

2013/6/14

#
The problem is that you can't reach a variable from another class in your class (not like you try to do this). This tutorial can help you getting to know how you can do this.
You need to login to post a reply.