Guidelines—Asking Questions

Summary (TL;DR)

Ask complete questions to get better answers!

  • Be specific. For example: I want to load an image. I tried using createImg() , and I expected the image to be on canvas, but what happened instead was the image showing up below the canvas.
  • Isolate your problem and work in small steps. Share only the code directly related to your problem if it is part of a bigger project, and if something isn’t working, try the smallest code that could do the thing you want.
  • Can we run your code to see the same thing as you?
  • Share what you tried. When you researched your problem, what did you find? What happened when you debugged your code?

This guide is meant to offer suggestions that will help you ask questions. Keep in mind that the developers of Processing, and the people answering questions here, are all doing this for free in their spare time. The best way to get better help: make it easier to answer your question!

Here are some tips to help make your question easier to answer:

Is your question specific?

It’s very hard to answer general “how do I do this” type questions. It’s much easier to answer specific “I tried X, expected Y, but got Z instead” type questions.

For example, a question like “How do I draw a garden?” is a pretty broad question. There are a bunch of different ways to approach it, and how you approach it depends on a lot of things that haven’t been decided yet: what do you want the garden to look like? What code have you written so far? What exactly are you confused about?

Compare that to a question like “I’m trying to draw a flower out of circles using the ellipse() function. I thought this code would draw 4 red circles with an orange circle on top of them, but the circles are being drawn on top of each other in the wrong order. Here’s the code I’m using so far…” This question is much easier to help with, because it’s a specific question about a specific piece of code.

Is your problem isolated?

It’s good to include code in your question, but you should only include the code that’s directly related to your problem. It can be very helpful to create a new blank sketch and only add as much code as is required to show the problem.

In our example of somebody asking about the flower in their garden scene, consider this code:

import ddf.minim.*;
import ddf.minim.analysis.*;
import ddf.minim.effects.*;
import ddf.minim.signals.*;
import ddf.minim.spi.*;
import ddf.minim.ugens.*;

PImage background;

Minim minim;
AudioPlayer song;

void setup() {
  fullScreen(); 
  background = loadImage("background.png");
  minim = new Minim(this);
  song = minim.loadFile("song.mp3");
  song.play();
}

void mousePressed() {
  // 100 lines of code for adding a butterfly
}

void draw() {
  background(background);

  // 100 lines of code for drawing grass

  fill(255, 128, 0);
  ellipse(100, 100, 100, 100);

  fill(255, 0, 0);
  ellipse(50, 50, 100, 100);
  ellipse(150, 50, 100, 100);
  ellipse(50, 150, 100, 100);
  ellipse(150, 150, 100, 100);

  // 100 lines of code for drawing clouds
}

This code has a few problems.

  • It loads the Minim library, which is not related to the problem.
  • This code will not run for anybody else, because they don’t have the song.mp3 file.
  • It uses a background image that’s not related to the problem.
  • This code will not run for anybody else, because they don’t have the background.png file.
  • It contains a mousePressed() function that’s not related to the problem.
  • It contains hundreds of lines of code for drawing grass and clouds.

All of these make it harder to understand the actual problem. Compare that code to this code:

size(200, 200);

fill(255, 128, 0);
ellipse(100, 100, 100, 100);

fill(255, 0, 0);
ellipse(50, 50, 100, 100);
ellipse(150, 50, 100, 100);
ellipse(50, 150, 100, 100);
ellipse(150, 150, 100, 100);

This is a full Processing sketch that contains only the code that’s directly related to the problem. This is much easier to debug and talk about.

Note that if you post extra code, you might be asked to narrow your problem down to a Minimum, Complete, Verifiable Example. This just means that you should try to isolate your code into a smaller example. Eliminate dependencies on libraries and external files, and get rid of any code that isn’t part of what you’re asking about.

You’ll often solve your own problem in the process of coming up with a simpler example that demonstrates the same behavior!

Are you working in small steps?

It’s always better to write code a few lines at a time and to test those lines as you go. Don’t try to write everything all at once, and don’t wait until you think you’re done to test your code out!

Break your problem down into smaller steps and take those steps on one at a time.

This will help you isolate your problem—if you’re working in small steps, you should know exactly which step you’re asking about. Then you can create a simple example program that just shows that one step.

Think about somebody who wrote a sketch that draws a whole garden scene. They’ve written hundreds of lines of code, but haven’t tried running it at all. When they finally do run it, nothing looks right and they get a NullPointerException in their code. It’s going to be very hard to help with this, because they don’t have just one problem.

Compare that to somebody who has been working in small steps. They’ve isolated their flower-drawing code into a single function that runs without needing any other functions. They’ve been testing as they’ve written the code, so they know the problem is in the drawFlower() function. This problem is much easier to solve.

Can we run your code to see the same thing as you?

When you’re putting together your example, double-check that other people can copy and paste your code to see the exact same thing as you. This means eliminating dependencies on external files and libraries.

Consider creating an example using CodePen or the P5.js editor so people can visit a URL to run your code.

You can use these CodePen templates:

Remember: the easier you make it for people to help you, the more help you’ll get!

What happened when you debugged your code?

Debugging is a huge part of programming. As you write code, you should constantly be reading though it line by line and testing that it’s working how you expected. Test your code as often as possible- try running your program every time you write a line of code and double-checking that the line of code is doing what you thought it would.

If your code is behaving differently from what you expected, the first thing you should do is read through your code line by line. Use a piece of paper to record the values of variables and to trace through the code. Then compare that to what actually happens- use println() or console.log() statements to figure out exactly what the code is doing. Try to pinpoint exactly where the execution of the code differed from what you expected it to do.

If you aren’t sure how to debug your code, here is a more general guide on debugging. If you’re running in a browser, make sure you check the JavaScript console for errors. If you’re getting an error message, try googling the error message. Chances are other people have had the same problem before!

What has your research told you?

A lot of programming is not actually typing code: it’s reading documentation, trying out examples, looking through references, googling, and consulting sites like Stack Overflow.

Make sure to include the research you’ve done.

For example, consider this post:

This code doesn’t work, and I don’t know why.

Compare that to this post:

This code draws the red petals over top of the orange center. I’ve tried googling “Processing draw order of shapes” and found this which talks about the PShape class, but I just want to draw basic circles. How do I draw the red petals underneath the orange center?

This question shows a lot more research and asks more specific questions that other people can help with.

Is your post formatted?

Proper formatting can make your post easier to read, which makes it easier for us to help you. Here are a few things to keep in mind:

  • Use punctuation.
  • Use multiple paragraphs. A wall of text is hard to read, so break it up with newlines.
  • Avoid using abbreviations like “u” instead of “you”.

Don’t forget to format your code! To format your code, highlight it and press the code button (it looks like </>) in the editor. This will surround your code with three tickmarks:

```
// code goes here
```

These three tick marks will preserve your code’s indentation and add syntax highlighting, which makes your code much easier to read.

Are you posting anywhere else?

If you’re posting to multiple sites, please link between the crossposts so we can see what help you’ve already received. A simple message like “By the way, I’m also posting this on Stack Overflow. Here is a link to that post…” is enough.

17 Likes
Convert java bufferedimage to PImage
Question about changing color over time
I want to know how this is expressed. 03
Array with 2 of the same value
Question about Draw Arrays
Flow of my program
Is it possible to construct PDFs by merging many PGraphics?
Data visualization with own images
Does anyone know how to convert processing to p5.js?
How to add stroke/fill/colour options to svg shape
John Whitney Arabesque
Multiple line graphs
P5 crashes chrome
Must qualify the allocation with
Creating ellipses with different colours and sizes
Custom classes with many drawing components?
Position problem
Need help in processing function
Assignment due soon i need help pls
Webcam Bar code/ QR code Read
How do I get the mousePressed function to change to different words each time on p5.js?
I can't describe what's my problem
Loading objs with callbacks
How to solve p5.js problem
Having multiple moving objects collide detection issues
How about the code when the ball is retracted and returned to its original position?
Oculus Go - How to disable cardboard splash screen?
Is there any way to implement invisibility using opencv js framework
Change background colour with a map
Anyone have any Improvements?
Parsing Data in Processing thru Serial Port from Arduino + Pixy Cam
ArrayoutOfBoundsException
Inheritance override draw()
I need help morphing two jpg images
Circle will become larger when mouse moves on it (loop question)
Shooting in a game
Tracking ball task with smooth curve
Ship fly through the gate (asteroids game)
Badly formed character constant
I want to know how this is expressed. 02
selectOutput feature
I want to know how this is expressed
mousePressed always true
Engg 233 final project
Final Project Engg 233
Processing program using OSC messages
Adding parent class to arraylist with internal function
Arraylist containing x sounds—How?
Parabolic Curve
Helping students with their homework
Issues with sound output
Need help to solve (skyscraper)
Guidelines in plain language
How to make clone stamp tool as the photoshop?
Making the bricks permanently disappear in Brickbreaker
Cloud Animation - Processing Basics
Can you help me fix problem in the code
Circulo con loop
Can you break and start an if loop?
Have an error when using OpenCV
Rotate problem with PGraphics
Please guys help me, I am trying to complete this morphing between obj
I need to make a reset timer in my Tic Tac Toe game
3D Perlin noise in Processing
Introducing randomness and asymmetry to shape
Multiple levels
Arduino - processing: serial data to toggle mp3 file in minim
Need a review to improve this :)
ArrayIndexoutofboundsexception: 9
Help in Rotate Image in JAVA2D
Sprites animation that use a lot of memory
Moving a molecule up and down
Cursor and mouse position alignment
Creating a floor plan! urgent! final assignment due
Drawing atomic orbitals
Guidelines in plain language
How to move the image with the arrows
Independently translate and rotate
P5.js video upload into switch statement
Lost keyPressed events
Why the rectMode(CENTER) doesn't work for me?
"String Index Out Of Bounds Exception: String index out of range: -1907998" Unknow error
Hello. I am just a beginner. I want to know how to complete a jump
Triangle using angles
How to set random colors
G4P GUI builder library help request
Hi Guys! I just need help figuring out how to change the color of the bouncing ball every time the player circle collides with it
How can I implement voice recognition in JAVA mode?
I want to create a pattern where i have 4 different squares in different colours that directly change color as a code. This is what i have, but i dont know how to change the color of the sqaures and then turn them back to normal in one time. Please help
Can't keep shape overlayed on top of video
Exported Linux app can't see its images when launched from AUTOSTART
Problem with Game Control Plus library button pressed
G4P library with GUI builder - Can I make Sliders in an Child applet?
Use millis to display real time
Connect USB webcam to Processing Android with Ketai
Helping students with their homework
How to check if "marco" is typed in textbox?
Please tell me how to save the Processing file as PNG
Helping students with their homework
3D Lidar point cloud to Blender
Hey! I need help with figuring out, how to make this outcome possible?
Preguntas Frecuentes (FAQ/Guidelines)
Need help on beginner project (Snake)
I have a problem to ask
Install P5. js mode for all user in a computer
How to create button that makes lines of text appear randomly
Use of p5.clear doubts
Help with Shapes (Smiley Face)
Help in Rotate Image in JAVA2D
Helping students with their homework
Android modo, en P 3.5.4, error "schemas". no genera apk firmado
Screens are not updating
Trayecto que se da de un lugar a otro al clickear
How to solve this fps problem?
Drawing a spectogram 2D (or 3D) from a recorded audio
How can i make exp system
Click and Drag to Scroll
About p5.js sketch
How Do you change the rotational origin for a shape?
A function that takes in a function Y and a number, and returns a function which when called, invokes Y some number of times
Updating pixels on a live video stream
For anidados ilusion
Storing all incoming data and button not working
Need help with dist()
Is it possible to show p5js program in Google Sites web site?
Help on loops (I'm a beginner)
How do I upload myArduinofile.ino to the Arduino Board (MEGA-UNO) from a Processing sketch
Looking for a Processing tutor
Access SVG file path ID for plotting data into it
Data from PDE to Arduinio IDE on continual basis
Text in loop to in several rows
Data from PDE to Arduinio IDE on continual basis
Area of triangle
There is an error, so I ask for advice: The program freezes. The program takes a lag
How do I find a maximum number of consecutive non-zero values in the array?
How to make squares bounce off of each other?
Trying to do light refraction and reflection
I would like to use the badwitch effect on the images in the "date" folder and export it to the "output" folder
How do i add colour to each one of the 10 boxes i made
Constrain() function / mouse click on button
Need help with these codes! (array)
Issues on installing Kinect - Cataline osx
Separate objects in an ArrayList
A question about my code (video)
Can't figure out how to get a value stored/used after clicking (calculator)
Help me program how to win in tic tac toe
Help with making a calculator
How do you choose what class you add to a list with a variable?
Null Pointer help and some guidance with a working EEPROM write Processing sketch
Random class from book of nature of code
Fixing video error on new Big Sur macOS with M1 chip
Converting 2d output to 3d
Why am I receiving NaN? What's wrong?
p5.Vector returns strange and negative x and y values
Not able to install processing
macOS question pixels[loc] issue
How to save an image from sketch windows
Expecting EOF, found else
Saving AudioSample as a sound file of any format
Applying filter to a specific region of a window
Pregunta mouseDragged , control en función draw
How to check for similar number in array and bring out a error sign
Processing.sound not working
I need help asap BEFORE 19:00 PM
Difference between collide and bounce in p5.play
Connect dots with lines
Object help new user
P5.js code for creating a calculator tip app confused
Two Player Pong game COLLISION FUNCTION DON'T WORK
Different background, Different item by mousePressed
How to extract values from a PVector?
Debug to processing pjs from processing 3
Error (: line 0)
Could Processing run on MacBook M1?
Storing data into an array (processing.sound)
Need help with creating barriers/walls with boolean
Dessiner plusieurs polygones et ils doivent formés une art polynomial
Dijkstra Algorithm view (Node, Edges)
Help with placing a shape on grid for tic tac toe. My code is shown below
[bezier.data.sql library] SHOW TABLE STATUS / It doesn't work. / help me
Make two sketches comunicate
I am finding an error while cloning the project in my local
Help with placing a shape on grid for tic tac toe. My code is shown below
Animated Text p5
My recorded DXF file turns up tilted when I open it in CAD
How can I make a program that hits balls in processing?
Random Colors with Shapes
Flip the image HORIZONTALLY
Tiling a triangle with buttons/clickable areas
Agregar musica a un codigo
Someone change this code but make it stay the same
Is there a way to use a native js function in p5?
From the Menu to the Game (mousePressed, programming tic tac toe)
How convert the Traveling Salesperson JS to Object-oriented Programming style Java Processing
Processing Download Issue MacOS
Problem coding Java (TRIANGLE_FAN )
Real-Time Py and Processing
We need to make a pure function where the pinde need to get sorted with highest to the left
Sampling Incoming data from serial port
Gradient along a row of squares
Needing help to rotate the camera around an object by moving the mouse away from the middle of the screen
Lock app screen, home
How to trigger P5js sketch with scroll
I need help with my code(scale problem)
Creating a Pong using tutorials
How do I change the random color for each petal of the flower?
Score help 30 hello
Help understanding Instance mode vs "normal mode"
Resize shapes random
Why is my Ico-Sphere not a Sphere
Highlighting tiles in range x
Neural Network genetic algorithm game
Timer after button pressed
Generative 3D Shapes
A newbie needs help
Object-oriented programming for the GAME
What does the % mean in the following code below
Help Any one give me info where i find one digital timer for Android mode
How to use an image as a link between different html pages
Play music - Clicking in objects
Need help with p5GUI in instance mode
Troubleshooting converting from .pde to p5 sketch
Teclear una letra y generar un objeto
Loading multiple models with a for loop?
Help Any one give me info where i find one digital timer for Android mode
Tower Hanoi (recursive) in Processing
Tower Hanoi (recursive) in Processing
Mouse/key pressed question
Tower Hanoi - Why recursive draw only first and last steps?
Help with Arduino and processing connection
MAYDAY MAYDAY / < ArrayIndexOutOfBoundsException: 3>
P2D vs JAVA2D Source-over alpha problems
Updating the topic template
Using Arduino for timer and using 2 readstringuntill
Help with genius game create
I have a club laser, now to... ...
P3D Processing source code / help me
Variable and Function Questions
BOUNCING circle in radius
Multiple print values from Arduino and Processing
How to fix the code belowed in order to delete the leftmost ellipse when keyPressed
I really need a help (circle getting smaller)
Unable to update int from serialReadStringUntil while in draw()
Generate captcha using processing
Short 5 second .PNG animation
Windows application export failing in python mode
Mobile robot navigation project
My project for mobile robot navigation, need help!
Run animation from the end point to the beginning point
Class code does not work in eclipse, library
Bars:Beats:Sixteenths
Printing a image with real inkjet printer
Difference between typography and strings?
(javascript) - ignore this post
Please guys help me, I am trying to complete this morphing between obj
Reading pixels from an image
Void error what is wrong?
Hired work for - 10K programmatically generated images
How to enforce a minimum distance between curves?
Suggestions for Randomizing Placement and Colors
Hey Guys! I'm very new to Processing and coding. I was wondering if y'all can guide me towards the right direction
Loop animated .gif in python mode
Object-oriented programming, I need a description about how this code works
Arc in layer. How to put an arc() in a layer
The command image() do not works
How to make flag?
Data type for ArrayList get() function (class, OOP)
My experience with the video
Making Box appear in random locations
Feeling completely lost regarding problem solving?
ControlP5 contol toggles
[deep-vision-processing library] Can I use it with new training?
Wait between port writes
Speed of ball in this code
Kinect 1414 and eye tracking
Loop inside another loop
Is this how motion sensors work?
This is the third chapter of the book "The Nature of Code" about friction and resistance, I don't know what the problem is, as a beginner this is my first problem I can't solve, so I ask you for help.THANKS!
Why Always report errors
Any way to export 3D interactive to .obj or other 3d format?
Can't install processing due to errors
Screen with objects
Need help with a health system in a game i'm making
Editor.p5js.org present mode disappeared - how to create transparent iframe?
8 bezier parameters to 12 bezier parameters in 3d
Truchet tiles quarter circles
Individualize functions in P5.js
Processing errors with macOS Catalina
'NoClassDefFoundError: com/sun/jna/Library' error with kinect v1
Using p5.distortion in p5.sound
Help with some Crosshairs
Image movement management - Donkey Kong Game
How do I make the snake's tail add on when i hit the apple?
Changing values?
Serial communication between Mac and micro:bit
Random functionality with SVG PShapes
Ball on platforms [School project]
Can I draw a figure every x milliseconds?
Editing window Cursor out of register Windows 10
How to make this rotating square reverse direction
Beginner at Processing Foundation
Any game engine that support Processing Java
How to packed JSON object over serial port (Serialise JSON object)
Balls fall then loop and restart at random position
[RESOLVED] A game menu with three levels
Present random shape, then fixed order (assignment help)
Need help scrambling an image
Move the character by pressing up key
Hello i need help with my homework (cross with line hatching)
Where can I find XMLpro library/How to read XML data with Processing?
PNG files appear pixelated
Problema "Could not load movie file data.mov"
"Could not load movie data.mov" problem
P_4_3_1_02 Image
Processing 4 crash issue
Need Help / Processing change video if
Video Capture from Skydroid OTG receiver
FSR pressure matrix
LoadShape() not working correctly
Replicating text
Loop inside loop - find latest loop value
Can't load native code to bring windows to front using the absolute path
Word in array counter
Time based project
Shuffling audio files in Minim on a pi Zero
I want to know how this is expressed. 01
Trying to make a multidimensional array which can connect to my buttons Please Help as soon as possible Please
Is there a way to do this progressively?
Merging 2 sketches into 1
Screen flickering when running Particle system
Download empty projects! - Bug!?
Importing SVG to p5.js sketch
Searching the internet
Find the color of a pixel
Help with static methods!
Adding parent class to arraylist with internal function
How do i add characters in a string, i have 11 digits in my string and i am supposed to add the odd number positions
Fibonacci spiral
Virtual Piano Help ASAP
Help with following code
How do i take a input that is space separated?
Data visualization with own images

2 posts were split to a new topic: Text covered by an image