|
Author |
Topic: Running Functions (Read 236 times) |
|
cap101
|
Running Functions
« on: Oct 21st, 2004, 3:02am » |
|
Hello everyone. Can functions only be executed to the main window from setup or loop? I am trying to get a for() statement working(from an object call) to create x number of objects over fps.
|
|
|
|
arielm
|
Re: Running Functions
« Reply #1 on: Oct 21st, 2004, 5:05pm » |
|
no need to "execute functions" from outside loop() or setup() instead, try something like: Code:MyClass obj; void setup() { obj = new MyClass(); } void run() { obj.run(); } class MyClass { int frameCounter = 0; void run() { frameCounter++; if ((frameCounter % 5) == 0) { foo(); } } } |
| in that example, the foo() method will be triggered every 5 frames... hth
|
Ariel Malka | www.chronotext.org
|
|
|
|