# Coding Questions

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

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

**Page:** 132

---

## [pushMatrix() cannot use push more than 32 times](https://discourse.processing.org/t/pushmatrix-cannot-use-push-more-than-32-times/12860)

<div class="topic-metadata">

**Author:** [@mezhaka](https://discourse.processing.org/u/mezhaka)\
**Replies:** 15\
**Last updated:** [July 24, 2019, 9:53am UTC](https://discourse.processing.org/t/pushmatrix-cannot-use-push-more-than-32-times/12860 "2019-07-24T09:53:25Z")

</div>

Why is this not a valid patch? I get a “RuntimeException: pushMatrix() cannot use push more than 32 times” error in a snippet that seems perfectly valid for me: void setup() { size(700, 500); } void dra…

---

## [Check direction of the mouse compared to a point in space](https://discourse.processing.org/t/check-direction-of-the-mouse-compared-to-a-point-in-space/12883)

<div class="topic-metadata">

**Author:** [@vincentstrebelle](https://discourse.processing.org/u/vincentstrebelle)\
**Replies:** 19\
**Last updated:** [July 24, 2019, 7:20am UTC](https://discourse.processing.org/t/check-direction-of-the-mouse-compared-to-a-point-in-space/12883 "2019-07-24T07:20:52Z")

</div>

Hi, i wonder how to check and know the directions (left,right,up and down) of the mouse compared to a point in space. void setup(){ size(300,300); } void draw(){ background(255); PVector dotPos = new PVector(150,…

---

## [Need help for a Battleships game in Processing](https://discourse.processing.org/t/need-help-for-a-battleships-game-in-processing/12818)

<div class="topic-metadata">

**Author:** [@chinzi](https://discourse.processing.org/u/chinzi)\
**Replies:** 17\
**Last updated:** [July 23, 2019, 12:45pm UTC](https://discourse.processing.org/t/need-help-for-a-battleships-game-in-processing/12818 "2019-07-23T12:45:53Z")

</div>

Hey everybody, Im new here, Im new to programming with Java and new to Processing. I want to code a Battleships game. It should look something like this in the end. I apologize for my bad english, but I hope you can und…

---

## [Add more Gravity Balls & Link a button to restart a screen... Beginner Coder](https://discourse.processing.org/t/add-more-gravity-balls-link-a-button-to-restart-a-screen-beginner-coder/12903)

<div class="topic-metadata">

**Author:** [@mclingerman](https://discourse.processing.org/u/mclingerman)\
**Replies:** 2\
**Last updated:** [July 23, 2019, 2:01am UTC](https://discourse.processing.org/t/add-more-gravity-balls-link-a-button-to-restart-a-screen-beginner-coder/12903 "2019-07-23T02:01:43Z")

</div>

Hey guys! I’ve just started learning to code in processing… Please forgive my “simple” approach. I have 2 things I need help with. I have looked for answers to these issues but have not been successful. Connecting my…

---

## [How do I create bubble writing in processing](https://discourse.processing.org/t/how-do-i-create-bubble-writing-in-processing/12878)

<div class="topic-metadata">

**Author:** [@abdulqureshi](https://discourse.processing.org/u/abdulqureshi)\
**Replies:** 3\
**Last updated:** [July 22, 2019, 5:08pm UTC](https://discourse.processing.org/t/how-do-i-create-bubble-writing-in-processing/12878 "2019-07-22T17:08:13Z")

</div>

I need urgent help. I’ve been told to complete some work for my uni place.The work is asking for me to create a sign that says MMU in bubble writing format. Please can someone help me

---

## [Why this code not working](https://discourse.processing.org/t/why-this-code-not-working/12886)

<div class="topic-metadata">

**Author:** [@maakin](https://discourse.processing.org/u/maakin)\
**Replies:** 4\
**Last updated:** [July 22, 2019, 3:27pm UTC](https://discourse.processing.org/t/why-this-code-not-working/12886 "2019-07-22T15:27:21Z")

</div>

PImage img; void setup() { size(200, 200); img = loadImage("sunflower.jpg"); } void draw() { loadPixels(); // Since we are going to access the image's pixels too img.loadPixels(); for (int y = 0; y \< he…

---

## [Need Help Connecting Points in 2D Array](https://discourse.processing.org/t/need-help-connecting-points-in-2d-array/12803)

<div class="topic-metadata">

**Author:** [@jmorri36](https://discourse.processing.org/u/jmorri36)\
**Replies:** 8\
**Last updated:** [July 22, 2019, 9:15am UTC](https://discourse.processing.org/t/need-help-connecting-points-in-2d-array/12803 "2019-07-22T09:15:45Z")

</div>

Hi, The sketch that I’m working on makes a random ripple on the screen, or when you click inside the ripple. Right now I have it with a bunch of points moving up and down on the Z axis along a grid. I’m having trouble…

---

## [Exporting Barnsley fern to SVG](https://discourse.processing.org/t/exporting-barnsley-fern-to-svg/12857)

<div class="topic-metadata">

**Author:** [@dr\_vblschrf](https://discourse.processing.org/u/dr_vblschrf)\
**Replies:** 5\
**Last updated:** [July 21, 2019, 4:49pm UTC](https://discourse.processing.org/t/exporting-barnsley-fern-to-svg/12857 "2019-07-21T16:49:24Z")

</div>

Hello. I’m going to start by saying that I’m very new to coding. Sorry for my inexperience! I’m trying to export a Barnsley fern code I found from Rosetta Code to an SVG. It needs to be SVG as it is for a vector art pro…

---

## [Simple example of 3D movement following a point?](https://discourse.processing.org/t/simple-example-of-3d-movement-following-a-point/12361)

<div class="topic-metadata">

**Author:** [@erkosone](https://discourse.processing.org/u/erkosone)\
**Replies:** 20\
**Last updated:** [July 4, 2019, 7:05pm UTC](https://discourse.processing.org/t/simple-example-of-3d-movement-following-a-point/12361 "2019-07-04T19:05:27Z")

</div>

hi, i need a simple example to how folllow in 3d a object. anybody can help me? The objective is simple, object a follow the object b in 3d space. My problem is the way to “orientation a to b” and “move” in orientatio…

---

## [Fire again once the cannon is moved](https://discourse.processing.org/t/fire-again-once-the-cannon-is-moved/12816)

<div class="topic-metadata">

**Author:** [@wandecoal](https://discourse.processing.org/u/wandecoal)\
**Replies:** 1\
**Last updated:** [July 19, 2019, 1:34pm UTC](https://discourse.processing.org/t/fire-again-once-the-cannon-is-moved/12816 "2019-07-19T13:34:33Z")

</div>

final int OBST\_WIDTH = 100; int targetWidth = OBST\_WIDTH; final int BARREL\_LENGTH = 45; int cloudDiam=50; /\* CHECK THIS LATER \*/ int spacing = cloudDiam; float cannonX = cloudDiam\*2; int cannonWidth = OBST\_WIDTH/2; …

---

## [Mouse position, camera and player movement](https://discourse.processing.org/t/mouse-position-camera-and-player-movement/12837)

<div class="topic-metadata">

**Author:** [@vincentstrebelle](https://discourse.processing.org/u/vincentstrebelle)\
**Replies:** 12\
**Last updated:** [July 20, 2019, 2:57pm UTC](https://discourse.processing.org/t/mouse-position-camera-and-player-movement/12837 "2019-07-20T14:57:36Z")

</div>

Hi, i started working on my player movements and i realise that i have a issue with the the coordinates of my mouse when i’m using a camera method. Here is my code: Player player; LimitOfTheWorld limitoftheworld; PVect…

---

## [Processing for iOS](https://discourse.processing.org/t/processing-for-ios/12798)

<div class="topic-metadata">

**Author:** [@ddownn](https://discourse.processing.org/u/ddownn)\
**Replies:** 3\
**Last updated:** [July 20, 2019, 12:00am UTC](https://discourse.processing.org/t/processing-for-ios/12798 "2019-07-20T00:00:08Z")

</div>

If anyone reading this has used the Processing for iOS app by Frederik Riedel and knows how to get a sketch to recognize the first screen tap as mousePressed, please let me know. It seems like the first mousePressed nev…

---

## [How to fill color in chess board](https://discourse.processing.org/t/how-to-fill-color-in-chess-board/12819)

<div class="topic-metadata">

**Author:** [@maakin](https://discourse.processing.org/u/maakin)\
**Replies:** 2\
**Last updated:** [July 19, 2019, 1:47pm UTC](https://discourse.processing.org/t/how-to-fill-color-in-chess-board/12819 "2019-07-19T13:47:18Z")

</div>

How to fill color in chess board

---

## [Help understanding code](https://discourse.processing.org/t/help-understanding-code/12799)

<div class="topic-metadata">

**Author:** [@Jackieh111](https://discourse.processing.org/u/Jackieh111)\
**Replies:** 3\
**Last updated:** [July 19, 2019, 10:11am UTC](https://discourse.processing.org/t/help-understanding-code/12799 "2019-07-19T10:11:52Z")

</div>

Hi The code below works but I don’t understand why to check boundaries I check boxSize/2 - ballSize instead of just boxSize-ballSize. I’m clearly not understanding something here. Can anyone explain it to me please? PV…

---

## [Using Frames to Display a 3rd Party App?](https://discourse.processing.org/t/using-frames-to-display-a-3rd-party-app/12788)

<div class="topic-metadata">

**Author:** [@YellowGTM](https://discourse.processing.org/u/YellowGTM)\
**Replies:** 1\
**Last updated:** [July 19, 2019, 4:35am UTC](https://discourse.processing.org/t/using-frames-to-display-a-3rd-party-app/12788 "2019-07-19T04:35:29Z")

</div>

Hello All, I’m using Processing ver. 3.3x and would like to Open/Launch a 3rd Party software to run within a “contained” frame. Is this possible? Please direct me to any functions/documents for further reading, or a …

---

## [REALLY basic functions problem](https://discourse.processing.org/t/really-basic-functions-problem/12794)

<div class="topic-metadata">

**Author:** [@EmptyAtoms](https://discourse.processing.org/u/EmptyAtoms)\
**Replies:** 12\
**Last updated:** [July 18, 2019, 6:59pm UTC](https://discourse.processing.org/t/really-basic-functions-problem/12794 "2019-07-18T18:59:45Z")

</div>

Hi all, So I’ve been given an assignment to produce a function that gets the lowest value of an array, then stores that value and uses it to color a circle, and write that same value onto that circle. I cannot get my f…

---

## [How to use for loops with transformations in processing?](https://discourse.processing.org/t/how-to-use-for-loops-with-transformations-in-processing/12782)

<div class="topic-metadata">

**Author:** [@phanirithvij](https://discourse.processing.org/u/phanirithvij)\
**Replies:** 5\
**Last updated:** [July 18, 2019, 12:52pm UTC](https://discourse.processing.org/t/how-to-use-for-loops-with-transformations-in-processing/12782 "2019-07-18T12:52:46Z")

</div>

So this is the code I wrote which I intend to draw n lines starting from a single point. Each separated by an angle of 2\*PI / n. int n; void setup(){ size(displayWidth, displayHeight); n = 7; } void draw(){ bac…

---

## [Create "random" function in processing.js?](https://discourse.processing.org/t/create-random-function-in-processing-js/12777)

<div class="topic-metadata">

**Author:** [@demsp](https://discourse.processing.org/u/demsp)\
**Replies:** 2\
**Last updated:** [July 18, 2019, 7:46am UTC](https://discourse.processing.org/t/create-random-function-in-processing-js/12777 "2019-07-18T07:46:15Z")

</div>

This function turn back a random number IntList listRand; void setup() { listRand=new IntList(); // void draw() { } int randm(int a,int b){ int y; int x=int( random(a,b) ); if (listRand.hasValue(x) == false) { …

---

## [Hitbox and death counter](https://discourse.processing.org/t/hitbox-and-death-counter/12763)

<div class="topic-metadata">

**Author:** [@Prantzz](https://discourse.processing.org/u/Prantzz)\
**Replies:** 5\
**Last updated:** [July 17, 2019, 7:12pm UTC](https://discourse.processing.org/t/hitbox-and-death-counter/12763 "2019-07-17T19:12:09Z")

</div>

Hey there, i’m new to processing and programming in general, so go easy on me :smiley: Well, i was writing this simple game for processing 3, and found myself into some difficulties. I Made 2 tabs, one for the main cod…

---

## [Changing the color of black pixels in area](https://discourse.processing.org/t/changing-the-color-of-black-pixels-in-area/12748)

<div class="topic-metadata">

**Author:** [@hensn](https://discourse.processing.org/u/hensn)\
**Replies:** 1\
**Last updated:** [July 16, 2019, 10:41pm UTC](https://discourse.processing.org/t/changing-the-color-of-black-pixels-in-area/12748 "2019-07-16T22:41:26Z")

</div>

Hi, I loaded a binary image (only black and white pixels) into processing. I want the user to be able to click on an area of the image (say a circle around the cursor) and each black pixel within that area then changes …

---

## [Save image selection into a (different) folder(s)](https://discourse.processing.org/t/save-image-selection-into-a-different-folder-s/12627)

<div class="topic-metadata">

**Author:** [@MissFroes](https://discourse.processing.org/u/MissFroes)\
**Replies:** 1\
**Last updated:** [July 16, 2019, 7:07am UTC](https://discourse.processing.org/t/save-image-selection-into-a-different-folder-s/12627 "2019-07-16T07:07:06Z")

</div>

Hi, I am new in Processing and I have this project that someone has to make an image selection then the selection has to be saved in a specific folder so that when the archive is running again that can save the new selec…

---

## [L system rules for drawing corals](https://discourse.processing.org/t/l-system-rules-for-drawing-corals/12733)

<div class="topic-metadata">

**Author:** [@MustafaMerza](https://discourse.processing.org/u/MustafaMerza)\
**Replies:** 3\
**Last updated:** [July 16, 2019, 6:32am UTC](https://discourse.processing.org/t/l-system-rules-for-drawing-corals/12733 "2019-07-16T06:32:47Z")

</div>

Hello guys, I’m sorry that I’m posting here but I haven’t found any other solution for my problem. I’m using an example code for L-System that comes when downloading examples from “The Nature of Code by Daniel Shiffman…

---

## [Is it possible to import from node.js to Processing?](https://discourse.processing.org/t/is-it-possible-to-import-from-node-js-to-processing/12706)

<div class="topic-metadata">

**Author:** [@Loji](https://discourse.processing.org/u/Loji)\
**Replies:** 2\
**Last updated:** [July 16, 2019, 4:33am UTC](https://discourse.processing.org/t/is-it-possible-to-import-from-node-js-to-processing/12706 "2019-07-16T04:33:54Z")

</div>

Hello, I’m curently trying to make a twitter bot using node.js and Processing. The node.js select some data from twitter and I’d like to use these data to make an image using Processing. Then export this image back to …

---

## [Array of images with effect](https://discourse.processing.org/t/array-of-images-with-effect/12705)

<div class="topic-metadata">

**Author:** [@JoseBri93](https://discourse.processing.org/u/JoseBri93)\
**Replies:** 1\
**Last updated:** [July 13, 2019, 5:45pm UTC](https://discourse.processing.org/t/array-of-images-with-effect/12705 "2019-07-13T17:45:12Z")

</div>

Hi, i’m trying to combine an array of random images with an effect i found in the processing sketches called Explode. I don’t realize what kind of variable I need to use to inicialize the action. So basically, this is t…

---

## [Copied out of the book - Uncaught ReferenceError: printArray is not definedShow stack](https://discourse.processing.org/t/copied-out-of-the-book-uncaught-referenceerror-printarray-is-not-definedshow-stack/12724)

<div class="topic-metadata">

**Author:** [@otorp2](https://discourse.processing.org/u/otorp2)\
**Replies:** 1\
**Last updated:** [July 15, 2019, 6:49pm UTC](https://discourse.processing.org/t/copied-out-of-the-book-uncaught-referenceerror-printarray-is-not-definedshow-stack/12724 "2019-07-15T18:49:49Z")

</div>

float\[\] f = { 0.3, 0.4, 0.5 }; void setup(){ size(100,100); background(100); printArray(f); }

---

## [Double/float conversion in time-based calculation won't update](https://discourse.processing.org/t/double-float-conversion-in-time-based-calculation-wont-update/12718)

<div class="topic-metadata">

**Author:** [@grumo](https://discourse.processing.org/u/grumo)\
**Replies:** 8\
**Last updated:** [July 15, 2019, 3:40pm UTC](https://discourse.processing.org/t/double-float-conversion-in-time-based-calculation-wont-update/12718 "2019-07-15T15:40:16Z")

</div>

This is strange or I’m missing something. The code is working, the calculations are right (about sun position using current date/time and latitude and longitude values) the relevant variables are updating quickly (hopefu…

---

## [Import Image and apply pattern](https://discourse.processing.org/t/import-image-and-apply-pattern/12229)

<div class="topic-metadata">

**Author:** [@alice](https://discourse.processing.org/u/alice)\
**Replies:** 22\
**Last updated:** [July 14, 2019, 6:28pm UTC](https://discourse.processing.org/t/import-image-and-apply-pattern/12229 "2019-07-14T18:28:07Z")

</div>

Hi, How can I import a black an white image and apply a patter like the image that I attached in this message? Hope someone can help, Thanks !

---

## [Inversely ellipses](https://discourse.processing.org/t/inversely-ellipses/12621)

<div class="topic-metadata">

**Author:** [@maakin](https://discourse.processing.org/u/maakin)\
**Replies:** 51\
**Last updated:** [July 14, 2019, 1:18am UTC](https://discourse.processing.org/t/inversely-ellipses/12621 "2019-07-14T01:18:54Z")

</div>

How to draw ellipses like this ( using for or while)

---

## [Xiaolin Wu line algorithm for antialiasing](https://discourse.processing.org/t/xiaolin-wu-line-algorithm-for-antialiasing/12670)

<div class="topic-metadata">

**Author:** [@Stanlepunk](https://discourse.processing.org/u/Stanlepunk)\
**Replies:** 1\
**Last updated:** [July 13, 2019, 8:41am UTC](https://discourse.processing.org/t/xiaolin-wu-line-algorithm-for-antialiasing/12670 "2019-07-13T08:41:56Z")

</div>

On my hard way to implement antialiasing, I found this algorithm from Xaolin Wu, but the problem is on the alpha value gestion, it’s very weird. when I put the value alpha it’s transparency and when I multiply by the alp…

---

## [Can a class method return the current instance of its class?](https://discourse.processing.org/t/can-a-class-method-return-the-current-instance-of-its-class/12690)

<div class="topic-metadata">

**Author:** [@ddownn](https://discourse.processing.org/u/ddownn)\
**Replies:** 2\
**Last updated:** [July 12, 2019, 9:25pm UTC](https://discourse.processing.org/t/can-a-class-method-return-the-current-instance-of-its-class/12690 "2019-07-12T21:25:15Z")

</div>

Like return this; or return new ClassName(this) or something like that… Of course I tried and it didn’t work, so I thought I’d ask if it’s possible. I’ve made a new Line class, and the following seems to work, I was ju…

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

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