Input to the game from another java class

Hello everyone,

I am new to a gaming engine and this forum.

I have gone through the tutorials and examples for beginners.

I want to know that is it possible that i can change the colour of the cube repeatedly, based on the input values coming from another java class.

I want to do things in the game based on the inputs coming from other (user defined) java classes.

Thanks for you help,


Yes, you can change the color of a material on any update.

Thanks, for your reply.

So, if i want to repetatively change the colour is it necessary to use the “simpleUpdate(float tpf)” function? I cannot define my own for loop?


As usual with software development, there’s more than one way to do it.

simpleUpdate() should work much better than a for loop – the reason being that the for loop (unless written very craftily) would prevent other code (such as JME’s rendering code) from executing.

My inclination would be to create a custom control or maybe an app state, but for a beginner, overriding simpleUpdate() is much simpler.

Good luck!

hmmm, i understand…, i have used simpleUpdate() and its working good.

Thank you very much for your help.