# Coding Questions

**URL:** https://discourse.processing.org/c/processing/processing-questions/15.md?page=160

[Latest](https://discourse.processing.org/latest.md) · [Categories](https://discourse.processing.org/categories.md) · [Tags](https://discourse.processing.org/tags.md)

**Page:** 161

---

## [How can I change the drawing style of a group of shapes?](https://discourse.processing.org/t/how-can-i-change-the-drawing-style-of-a-group-of-shapes/6330)

<div class="topic-metadata">

**Author:** [@mono](https://discourse.processing.org/u/mono)\
**Replies:** 3\
**Last updated:** [December 8, 2018, 2:42am UTC](https://discourse.processing.org/t/how-can-i-change-the-drawing-style-of-a-group-of-shapes/6330 "2018-12-08T02:42:21Z")

</div>

Hey guys. I have written this code here to draw a group of 3 shapes on the screen: PShape s; void setup() { size (40, 40); s = createShape(GROUP); ellipseMode(CENTER); PShape s1 = createShape(ELLIPSE, 0, 0, 1…

---

## [Urgent : Codes of autonomous agent](https://discourse.processing.org/t/urgent-codes-of-autonomous-agent/6403)

<div class="topic-metadata">

**Author:** [@gisue](https://discourse.processing.org/u/gisue)\
**Replies:** 5\
**Last updated:** [December 7, 2018, 11:41pm UTC](https://discourse.processing.org/t/urgent-codes-of-autonomous-agent/6403 "2018-12-07T23:41:48Z")

</div>

can any one help me with this code, I need it right now, since I have final submission and presentation today. please help me. my code runs the stop after 10 second // Path Following // Using this variable to decide wh…

---

## [Parabolic projectile launch](https://discourse.processing.org/t/parabolic-projectile-launch/6322)

<div class="topic-metadata">

**Author:** [@saotome](https://discourse.processing.org/u/saotome)\
**Replies:** 7\
**Last updated:** [December 7, 2018, 8:00pm UTC](https://discourse.processing.org/t/parabolic-projectile-launch/6322 "2018-12-07T20:00:49Z")

</div>

I,m trying to change the value of vi using left&rigth arrows and the theta value with up&down arrows, but i don’t know exactlu how to do it. The code is the following // based on Projectile Simulation by Hugo Meiring /…

---

## [Function as argument of another function](https://discourse.processing.org/t/function-as-argument-of-another-function/6383)

<div class="topic-metadata">

**Author:** [@jb4x](https://discourse.processing.org/u/jb4x)\
**Replies:** 4\
**Last updated:** [December 7, 2018, 7:51pm UTC](https://discourse.processing.org/t/function-as-argument-of-another-function/6383 "2018-12-07T19:51:21Z")

</div>

Hi everyone, I’m trying to pass a function as an argument of another function but can’t figure out how… I’ve found plenty of infos on solution for Java 8 but sadly we can’t use those solution with processing if I get i…

---

## [Potential JSONObject bug?](https://discourse.processing.org/t/potential-jsonobject-bug/5930)

<div class="topic-metadata">

**Author:** [@RecursiveCursive](https://discourse.processing.org/u/RecursiveCursive)\
**Replies:** 2\
**Last updated:** [December 7, 2018, 7:37pm UTC](https://discourse.processing.org/t/potential-jsonobject-bug/5930 "2018-12-07T19:37:55Z")

</div>

My project makes use of JSON to store user data, but I am having a strange issue with it. One of my methods is a delete method that is supposed to delete saved data and replace it with a single entry indicating no saved …

---

## [Should negative width in image produce mirroring?](https://discourse.processing.org/t/should-negative-width-in-image-produce-mirroring/6366)

<div class="topic-metadata">

**Author:** [@hamoid](https://discourse.processing.org/u/hamoid)\
**Replies:** 9\
**Last updated:** [December 7, 2018, 3:43pm UTC](https://discourse.processing.org/t/should-negative-width-in-image-produce-mirroring/6366 "2018-12-07T15:43:03Z")

</div>

I wonder if this is a bug… PGraphics canvas; void setup() { size(600, 600); // P2D make no difference canvas = createGraphics(width, height); } void draw() { background(255); canvas.beginDraw(); canvas.clear(…

---

## [Processing SpaceInvaders-Game](https://discourse.processing.org/t/processing-spaceinvaders-game/6126)

<div class="topic-metadata">

**Author:** [@ProcessingHelp](https://discourse.processing.org/u/ProcessingHelp)\
**Replies:** 2\
**Last updated:** [December 7, 2018, 2:53pm UTC](https://discourse.processing.org/t/processing-spaceinvaders-game/6126 "2018-12-07T14:53:38Z")

</div>

Delete this post.

---

## [Xml verification](https://discourse.processing.org/t/xml-verification/6253)

<div class="topic-metadata">

**Author:** [@matheplica](https://discourse.processing.org/u/matheplica)\
**Replies:** 2\
**Last updated:** [December 7, 2018, 1:51pm UTC](https://discourse.processing.org/t/xml-verification/6253 "2018-12-07T13:51:32Z")

</div>

Hi, I’m trying to load a xml file only if he’s correct (no tags errors) I’have try this void checkXml(String fileName) { try { data = loadXML(fileName); } catch(Exception e) { print(e); } } I put just …

---

## [Hue with specific colors](https://discourse.processing.org/t/hue-with-specific-colors/6297)

<div class="topic-metadata">

**Author:** [@Missmew72](https://discourse.processing.org/u/Missmew72)\
**Replies:** 5\
**Last updated:** [December 7, 2018, 12:50am UTC](https://discourse.processing.org/t/hue-with-specific-colors/6297 "2018-12-07T00:50:30Z")

</div>

Hi, so I’m working on a school project and basically I want the option for hue in the background. I am able to get a horizontal hue with all the colours, but I was hoping to do a vertical hue with a specific set of colou…

---

## [ArrayList causing an IndexOutOfBoundsException](https://discourse.processing.org/t/arraylist-causing-an-indexoutofboundsexception/6247)

<div class="topic-metadata">

**Author:** [@CyberneticSquid](https://discourse.processing.org/u/CyberneticSquid)\
**Replies:** 2\
**Last updated:** [December 7, 2018, 12:09am UTC](https://discourse.processing.org/t/arraylist-causing-an-indexoutofboundsexception/6247 "2018-12-07T00:09:35Z")

</div>

I’m making a basic “Life” game, where larger circles eat smaller ones, and I keep getting a seemingly random IndexOutOfBoundsException. This is the section of code that causes the error: for (int i = beings.size() - …

---

## [Generating a live Jpeg from random numbers](https://discourse.processing.org/t/generating-a-live-jpeg-from-random-numbers/6066)

<div class="topic-metadata">

**Author:** [@glegassick](https://discourse.processing.org/u/glegassick)\
**Replies:** 5\
**Last updated:** [December 6, 2018, 10:17pm UTC](https://discourse.processing.org/t/generating-a-live-jpeg-from-random-numbers/6066 "2018-12-06T22:17:32Z")

</div>

Hi, I am new to the community and new to Processing and have a project in mind that I would like to tackle in order to learn. I would like to generate a “live” jpeg image from random number inputs. I am aware that the …

---

## [Setting limit of random colours](https://discourse.processing.org/t/setting-limit-of-random-colours/6051)

<div class="topic-metadata">

**Author:** [@CowPieForever](https://discourse.processing.org/u/CowPieForever)\
**Replies:** 5\
**Last updated:** [December 6, 2018, 8:21pm UTC](https://discourse.processing.org/t/setting-limit-of-random-colours/6051 "2018-12-06T20:21:07Z")

</div>

So I have written that, when drawing a shape, the stroke and fill are random colours: stroke(random(255),random(255),random(255)); fill(random(255),random(255),random(255)); So if I wanted to set the colours to be rand…

---

## [Help on adding Color Collision to my game](https://discourse.processing.org/t/help-on-adding-color-collision-to-my-game/6358)

<div class="topic-metadata">

**Author:** [@Catbreath1](https://discourse.processing.org/u/Catbreath1)\
**Replies:** 2\
**Last updated:** [December 6, 2018, 2:49pm UTC](https://discourse.processing.org/t/help-on-adding-color-collision-to-my-game/6358 "2018-12-06T14:49:35Z")

</div>

Hey, so I am somewhat new to coding, and I have began to create a game out of what I knew. The game is pretty much like the Chrome dino jump game, but simplified for now as I make the base code. So far, I have all I need…

---

## [Mirror effect by mouse movement](https://discourse.processing.org/t/mirror-effect-by-mouse-movement/6363)

<div class="topic-metadata">

**Author:** [@AnisZo](https://discourse.processing.org/u/AnisZo)\
**Replies:** 3\
**Last updated:** [December 6, 2018, 1:51pm UTC](https://discourse.processing.org/t/mirror-effect-by-mouse-movement/6363 "2018-12-06T13:51:30Z")

</div>

Hi, guys, I have a question how can I mirror my mouse event? At the moment I have a growing lightningbolt while moving my mouse and I need it mirrored now. Here is the code int width = 250; int height = 250; //angl…

---

## [How do I make a ball continuously bounce on one platform?](https://discourse.processing.org/t/how-do-i-make-a-ball-continuously-bounce-on-one-platform/6355)

<div class="topic-metadata">

**Author:** [@irukandjijelly](https://discourse.processing.org/u/irukandjijelly)\
**Replies:** 2\
**Last updated:** [December 6, 2018, 9:45am UTC](https://discourse.processing.org/t/how-do-i-make-a-ball-continuously-bounce-on-one-platform/6355 "2018-12-06T09:45:13Z")

</div>

This is my code. What can I do to make the ball up and down on one platform. Right now when the right key is pressed, it goes straight up. int y=770; int back=20; int dir=20; int level=3; void setup(){ size(700,80…

---

## [Help with creating the correct functions for my ATM](https://discourse.processing.org/t/help-with-creating-the-correct-functions-for-my-atm/6337)

<div class="topic-metadata">

**Author:** [@Sventhepuffin](https://discourse.processing.org/u/Sventhepuffin)\
**Replies:** 9\
**Last updated:** [December 6, 2018, 7:08am UTC](https://discourse.processing.org/t/help-with-creating-the-correct-functions-for-my-atm/6337 "2018-12-06T07:08:06Z")

</div>

I know it is sloppy or most likely not done correct, i’m not very good at this but i’m still trying. I have been able to assign each numbered button to display its corresponding number but when it comes to creating the f…

---

## [Parallel Array for ripple effect/rain drop](https://discourse.processing.org/t/parallel-array-for-ripple-effect-rain-drop/6268)

<div class="topic-metadata">

**Author:** [@James](https://discourse.processing.org/u/James)\
**Replies:** 1\
**Last updated:** [December 5, 2018, 9:13pm UTC](https://discourse.processing.org/t/parallel-array-for-ripple-effect-rain-drop/6268 "2018-12-05T21:13:55Z")

</div>

Hello guys and gals, I’m trying to make something really weird and kinda stupid (ripple effect/rain drop effect). I’m trying to make a partial full array that can hold up to 1000 x & y cords pair. For me to do that I wi…

---

## [Help with interfaces](https://discourse.processing.org/t/help-with-interfaces/6272)

<div class="topic-metadata">

**Author:** [@dcravens](https://discourse.processing.org/u/dcravens)\
**Replies:** 1\
**Last updated:** [December 5, 2018, 9:00pm UTC](https://discourse.processing.org/t/help-with-interfaces/6272 "2018-12-05T21:00:13Z")

</div>

I am a beginning coder trying to understand the best way to organize my code using inheritance, composition, and interfaces in a program that models a simple ecosystem. I apologize in advance for not knowing how word m…

---

## [Trying to use modelX() but built a spiral galaxy of points](https://discourse.processing.org/t/trying-to-use-modelx-but-built-a-spiral-galaxy-of-points/6064)

<div class="topic-metadata">

**Author:** [@HackinHarry](https://discourse.processing.org/u/HackinHarry)\
**Replies:** 26\
**Last updated:** [December 5, 2018, 6:18pm UTC](https://discourse.processing.org/t/trying-to-use-modelx-but-built-a-spiral-galaxy-of-points/6064 "2018-12-05T18:18:16Z")

</div>

I’m trying to use modelX() and modelY() to capture transformed coordinate values of a shape. I’ve cut the code down from 600 lines to 200 some by using processing’s built in functions rather than struggle with writing …

---

## [How to distribuite a value unequally?](https://discourse.processing.org/t/how-to-distribuite-a-value-unequally/6104)

<div class="topic-metadata">

**Author:** [@Lexyth](https://discourse.processing.org/u/Lexyth)\
**Replies:** 18\
**Last updated:** [December 5, 2018, 12:08pm UTC](https://discourse.processing.org/t/how-to-distribuite-a-value-unequally/6104 "2018-12-05T12:08:01Z")

</div>

Hey, so distributing a value equally is just 50/5 = 5 Times a 10 value, But i Would Need a result of something like {15, 5, 20, 7, 3}. Now, i technically know how to do this in Code, But it‘s not very efficient, so i was…

---

## [Last click and keeping the image](https://discourse.processing.org/t/last-click-and-keeping-the-image/6317)

<div class="topic-metadata">

**Author:** [@Missmew72](https://discourse.processing.org/u/Missmew72)\
**Replies:** 6\
**Last updated:** [December 5, 2018, 11:27am UTC](https://discourse.processing.org/t/last-click-and-keeping-the-image/6317 "2018-12-05T11:27:49Z")

</div>

So I have a series of clicks setup, each click replaces the last image with the next one. When I get to the last image, I want it to stay even if there is an accidental click afterwards. Is there a way to do this?

---

## [How to have my image move horizontally?](https://discourse.processing.org/t/how-to-have-my-image-move-horizontally/6321)

<div class="topic-metadata">

**Author:** [@CyanNi](https://discourse.processing.org/u/CyanNi)\
**Replies:** 3\
**Last updated:** [December 5, 2018, 10:00am UTC](https://discourse.processing.org/t/how-to-have-my-image-move-horizontally/6321 "2018-12-05T10:00:16Z")

</div>

I’m working on my game that’s based on the chrome dino run game that plays whenever you’re offline. However, I’m facing a problem, I can’t get my image to move the way the dino does in the game. I’m sorry for bothering…

---

## [How to insert colourMode()s into stroke and fill](https://discourse.processing.org/t/how-to-insert-colourmode-s-into-stroke-and-fill/6049)

<div class="topic-metadata">

**Author:** [@CowPieForever](https://discourse.processing.org/u/CowPieForever)\
**Replies:** 3\
**Last updated:** [December 5, 2018, 5:43am UTC](https://discourse.processing.org/t/how-to-insert-colourmode-s-into-stroke-and-fill/6049 "2018-12-05T05:43:06Z")

</div>

Sorry if this is a dumb question, I’m pretty new at this. I would like to insert different colourMode()s into the actual stroke and fill command of a specific shape. How can I do this? Following the instructions on the p…

---

## [If mousePressed, each click results in different event](https://discourse.processing.org/t/if-mousepressed-each-click-results-in-different-event/6285)

<div class="topic-metadata">

**Author:** [@Missmew72](https://discourse.processing.org/u/Missmew72)\
**Replies:** 3\
**Last updated:** [December 5, 2018, 2:53am UTC](https://discourse.processing.org/t/if-mousepressed-each-click-results-in-different-event/6285 "2018-12-05T02:53:58Z")

</div>

Hi, so I’m new to processing and I have to create a school project. What I want to do is when I click the first time, an image appears. When I click a second time, the first image is replaces with the second image. I nee…

---

## [How to go about scaling a set of objects all together?](https://discourse.processing.org/t/how-to-go-about-scaling-a-set-of-objects-all-together/6231)

<div class="topic-metadata">

**Author:** [@francium401](https://discourse.processing.org/u/francium401)\
**Replies:** 3\
**Last updated:** [December 4, 2018, 4:26am UTC](https://discourse.processing.org/t/how-to-go-about-scaling-a-set-of-objects-all-together/6231 "2018-12-04T04:26:41Z")

</div>

I have drawn four triangles to form a tree-looking object. I want to scale all the triangles it to a bigger size so that the tree looks bigger, say for example 200%. What do I need to do to achieve this? void setup(){ …

---

## [mousePressed to change image multiple times](https://discourse.processing.org/t/mousepressed-to-change-image-multiple-times/6275)

<div class="topic-metadata">

**Author:** [@Missmew72](https://discourse.processing.org/u/Missmew72)\
**Replies:** 1\
**Last updated:** [December 4, 2018, 4:06am UTC](https://discourse.processing.org/t/mousepressed-to-change-image-multiple-times/6275 "2018-12-04T04:06:23Z")

</div>

Hi, so I am making a code for a school project. It’s nothing too fancy but I’m very new to the program and have been trying to find a way around the issue but ave had no luck. Basically I have an image that is there when…

---

## [Why doesn't curveVertex work in this PShape](https://discourse.processing.org/t/why-doesnt-curvevertex-work-in-this-pshape/6263)

<div class="topic-metadata">

**Author:** [@ddownn](https://discourse.processing.org/u/ddownn)\
**Replies:** 2\
**Last updated:** [December 4, 2018, 3:28am UTC](https://discourse.processing.org/t/why-doesnt-curvevertex-work-in-this-pshape/6263 "2018-12-04T03:28:11Z")

</div>

I was looking at an example of creating a spiral on the old Processing forum, drawing a spiral size(800,800); smooth(); translate(width/2,height/2); strokeWeight(2); beginShape(); for(int i=0;i\<350;i++) { curveVertex(…

---

## [How do I draw shapes over an image?](https://discourse.processing.org/t/how-do-i-draw-shapes-over-an-image/6228)

<div class="topic-metadata">

**Author:** [@JennyMcCreadie](https://discourse.processing.org/u/JennyMcCreadie)\
**Replies:** 2\
**Last updated:** [December 4, 2018, 12:31am UTC](https://discourse.processing.org/t/how-do-i-draw-shapes-over-an-image/6228 "2018-12-04T00:31:56Z")

</div>

Hello It’s super simple but I’m trying to write a code where I have a background image and when you click on it or run the mouse over it, squares appear and stay on the page. I know it’s most likely to do with the order…

---

## [Sequential Loop with Images](https://discourse.processing.org/t/sequential-loop-with-images/6160)

<div class="topic-metadata">

**Author:** [@RienziDeal](https://discourse.processing.org/u/RienziDeal)\
**Replies:** 4\
**Last updated:** [December 3, 2018, 8:41pm UTC](https://discourse.processing.org/t/sequential-loop-with-images/6160 "2018-12-03T20:41:11Z")

</div>

Hi everyone, I created 36 different png’s of this orb that I designed in photoshop and I need to make processing run through all 36 of the images and then just do that forever so it looks like the orb is changing color. …

---

## [Drawing a line in a random direction from the end of a line](https://discourse.processing.org/t/drawing-a-line-in-a-random-direction-from-the-end-of-a-line/6262)

<div class="topic-metadata">

**Author:** [@jam.prescott](https://discourse.processing.org/u/jam.prescott)\
**Replies:** 4\
**Last updated:** [December 3, 2018, 5:52pm UTC](https://discourse.processing.org/t/drawing-a-line-in-a-random-direction-from-the-end-of-a-line/6262 "2018-12-03T17:52:21Z")

</div>

Just started out using processing for a project and theres a drawing I’m trying to create. If this makes sense I’m trying to, Draw a line from a random point with a random length at a random direction Then draw a li…

[Previous page](https://discourse.processing.org/c/processing/processing-questions/15.md?page=159)

[Next page](https://discourse.processing.org/c/processing/processing-questions/15.md?page=161)
