Ask coding questions

← Back to all posts
How do I access Processing.org (Java) functions inside a Class?
MichaelOliva (0)

I teach AP CS-A, and want to start using Processing with my students, but many only have access to online tools, so we use Replit.com exclusively.

I just came across the Processing template (https://replit.com/@templates/Processing), which allowed me animate a simple Asteroids ship. But when I tried to create a class (Floater) to do this, I got an error indicating the Processing functions I was using are not accessible (i.e. stoke() and line() ). This works in Processing, but not in this Replit.com template.

I tried Sketch.line() but that didn't work.

Any thoughts or work arounds?

Comments
hotnewtop
Coder100 (17011)

This is the Java environment, not the processing Java environment.

That is different. That environment is an 'adaptation' of the Java programming language, but less featured and built for the web and graphics in mind.

MichaelOliva (0)

@Coder100
Thanks for the reply, but I'm not sure I understand what you mean. By 'this' do you mean Replit? Or processing.core.PApplet?

Coder100 (17011)

by this, specifically i meant your repl language @MichaelOliva