# Coding Questions

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

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

**Page:** 115

---

## [Setting 1st instance location for evenly spaced rotated objects](https://discourse.processing.org/t/setting-1st-instance-location-for-evenly-spaced-rotated-objects/16479)

<div class="topic-metadata">

**Author:** [@debxyz](https://discourse.processing.org/u/debxyz)\
**Replies:** 11\
**Last updated:** [December 17, 2019, 11:08pm UTC](https://discourse.processing.org/t/setting-1st-instance-location-for-evenly-spaced-rotated-objects/16479 "2019-12-17T23:08:12Z")

</div>

I am rotating small evenly spaced circles around the circumference of a larger circle. Using the while loop I have a version with 4 small circles and a version with 6 small circles. The 4 small circles version places t…

---

## [Interactividad y escenas](https://discourse.processing.org/t/interactividad-y-escenas/16355)

<div class="topic-metadata">

**Author:** [@humano](https://discourse.processing.org/u/humano)\
**Replies:** 3\
**Last updated:** [December 16, 2019, 8:29pm UTC](https://discourse.processing.org/t/interactividad-y-escenas/16355 "2019-12-16T20:29:43Z")

</div>

Hi everybody, I’m on the last step to finish my sketch, but losing my head with somoething I don’t get. Sketch has scene1, that lasts 5 seconds. Then, scene 2 has a button that activates animation called scene 3. Final…

---

## [How to make the snake not move constantly](https://discourse.processing.org/t/how-to-make-the-snake-not-move-constantly/16453)

<div class="topic-metadata">

**Author:** [@crazybob5](https://discourse.processing.org/u/crazybob5)\
**Replies:** 2\
**Last updated:** [December 17, 2019, 8:23am UTC](https://discourse.processing.org/t/how-to-make-the-snake-not-move-constantly/16453 "2019-12-17T08:23:47Z")

</div>

Hi, How to make the snake not move constantly? int angle=0; int snakesize=10; int time=0; int\[\] headx= new int\[2500\]; int\[\] heady= new int\[2500\]; int applex=(round(random(47))+1)\*8; int appley=(round(random(47))+1)\*8; b…

---

## [Having trouble with if/else statement](https://discourse.processing.org/t/having-trouble-with-if-else-statement/16460)

<div class="topic-metadata">

**Author:** [@lilturkey7](https://discourse.processing.org/u/lilturkey7)\
**Replies:** 5\
**Last updated:** [December 17, 2019, 6:28am UTC](https://discourse.processing.org/t/having-trouble-with-if-else-statement/16460 "2019-12-17T06:28:24Z")

</div>

Hi, I’m new to Processing. I’m using the program as an introduction to coding in my high school class. I’m currently making a face but I’m having trouble with switching the display of two shapes. PShape face1, head, ey…

---

## [Class Constructor Block not working](https://discourse.processing.org/t/class-constructor-block-not-working/16282)

<div class="topic-metadata">

**Author:** [@hamp](https://discourse.processing.org/u/hamp)\
**Replies:** 12\
**Last updated:** [December 16, 2019, 11:55pm UTC](https://discourse.processing.org/t/class-constructor-block-not-working/16282 "2019-12-16T23:55:34Z")

</div>

So I’m just starting out on processing and I run into this error: Unexpected token: { Here is my code: Person joe; void setup(){ size(500,500); background(0); Person joe = new Person(); } void draw(){ joe.di…

---

## [Paint application](https://discourse.processing.org/t/paint-application/16356)

<div class="topic-metadata">

**Author:** [@Swagific](https://discourse.processing.org/u/Swagific)\
**Replies:** 14\
**Last updated:** [December 16, 2019, 8:37pm UTC](https://discourse.processing.org/t/paint-application/16356 "2019-12-16T20:37:07Z")

</div>

Im trying to make a paint application. when i click on the shape icons the shape of the brush dosent change. when i click on the save icons they dont work either. im not sure what im missing in my code to get them to wor…

---

## [Recreating that Joy Division album cover](https://discourse.processing.org/t/recreating-that-joy-division-album-cover/16444)

<div class="topic-metadata">

**Author:** [@dalphabet](https://discourse.processing.org/u/dalphabet)\
**Replies:** 8\
**Last updated:** [December 16, 2019, 7:16pm UTC](https://discourse.processing.org/t/recreating-that-joy-division-album-cover/16444 "2019-12-16T19:16:24Z")

</div>

I found an Openprocessing code of an album cover of Joy Division’s ‘Unknown Pleasures’. The code was originally written by Craig S. Kaplan. So overwhelmed by the beauty of it, I attempted to translate this to pde. Howeve…

---

## [Problem with "splitscreen" in one window](https://discourse.processing.org/t/problem-with-splitscreen-in-one-window/16418)

<div class="topic-metadata">

**Author:** [@Zerichy](https://discourse.processing.org/u/Zerichy)\
**Replies:** 4\
**Last updated:** [December 16, 2019, 2:09pm UTC](https://discourse.processing.org/t/problem-with-splitscreen-in-one-window/16418 "2019-12-16T14:09:38Z")

</div>

Hello, i wanted to do the mandelbrot/julia set challenge from codingtrain that these two fractals are in one window and you can hover over the mandelbrot set and see the corresponding julia set next to it change (like he…

---

## [New to processing (centipede) stuck on tail](https://discourse.processing.org/t/new-to-processing-centipede-stuck-on-tail/16324)

<div class="topic-metadata">

**Author:** [@crazybob5](https://discourse.processing.org/u/crazybob5)\
**Replies:** 7\
**Last updated:** [December 16, 2019, 10:09am UTC](https://discourse.processing.org/t/new-to-processing-centipede-stuck-on-tail/16324 "2019-12-16T10:09:48Z")

</div>

Im fairly new to processing and im working on doing a basic game but im stuck on adding a tail to the centipede. float x = 0; float y = 0; float spacing = 50; float positiex = 200; float positiey = 200; void setup() …

---

## [Trying to understand the "Substrate" algorithm](https://discourse.processing.org/t/trying-to-understand-the-substrate-algorithm/3031)

<div class="topic-metadata">

**Author:** [@solub](https://discourse.processing.org/u/solub)\
**Replies:** 16\
**Last updated:** [December 16, 2019, 9:41am UTC](https://discourse.processing.org/t/trying-to-understand-the-substrate-algorithm/3031 "2019-12-16T09:41:34Z")

</div>

Dear all, I would really appreciate if someone could help me decipher some parts of Jared Tarbell’s “substrate” algorithm. For those who are not familiar with this famous sketch, here is a recap in Tarbell’s own words: …

---

## [Making a shadowcaster](https://discourse.processing.org/t/making-a-shadowcaster/16432)

<div class="topic-metadata">

**Author:** [@Wattscanaan10](https://discourse.processing.org/u/Wattscanaan10)\
**Replies:** 1\
**Last updated:** [December 16, 2019, 2:16am UTC](https://discourse.processing.org/t/making-a-shadowcaster/16432 "2019-12-16T02:16:55Z")

</div>

So im trying to write a 2d raycaster for the first time, and im having trouble only drawing lines to the closest walls. i cant find what to do next Code: Source source; Ray ray; Wall\[\] walls = new Wall\[2\]; void setup(…

---

## [Making a spiral shooting enemy](https://discourse.processing.org/t/making-a-spiral-shooting-enemy/16411)

<div class="topic-metadata">

**Author:** [@davidclue](https://discourse.processing.org/u/davidclue)\
**Replies:** 9\
**Last updated:** [December 16, 2019, 1:45am UTC](https://discourse.processing.org/t/making-a-spiral-shooting-enemy/16411 "2019-12-16T01:45:34Z")

</div>

Hi I was wondering on how to make an enemy shoot in a spiral way around the screen. BasicEnemy(float tempX, float tempY, int tempXdir, int tempYdir, int tempSize, float tempSpeed, float tempDamage) Thats the constructo…

---

## [Help with Processing projects (Post 2 of 2)](https://discourse.processing.org/t/help-with-processing-projects-post-2-of-2/16436)

<div class="topic-metadata">

**Author:** [@ImConfused](https://discourse.processing.org/u/ImConfused)\
**Replies:** 2\
**Last updated:** [December 15, 2019, 11:41pm UTC](https://discourse.processing.org/t/help-with-processing-projects-post-2-of-2/16436 "2019-12-15T23:41:51Z")

</div>

I have no idea how to set it up

---

## [OutOfMemoryError when loading images at startup of sketch](https://discourse.processing.org/t/outofmemoryerror-when-loading-images-at-startup-of-sketch/16429)

<div class="topic-metadata">

**Author:** [@Tim076](https://discourse.processing.org/u/Tim076)\
**Replies:** 2\
**Last updated:** [December 15, 2019, 11:01pm UTC](https://discourse.processing.org/t/outofmemoryerror-when-loading-images-at-startup-of-sketch/16429 "2019-12-15T23:01:39Z")

</div>

Hi all, My sketch throws an OutOfMemoryError when I try to run it. However I only try to load in a total of 9 images with a combined size of 5 MB. I also only call loadImage in setup so I’m not constantly loading images…

---

## [Resize Processing canvas in JavaFX window](https://discourse.processing.org/t/resize-processing-canvas-in-javafx-window/16353)

<div class="topic-metadata">

**Author:** [@Ackados](https://discourse.processing.org/u/Ackados)\
**Replies:** 3\
**Last updated:** [December 15, 2019, 6:03pm UTC](https://discourse.processing.org/t/resize-processing-canvas-in-javafx-window/16353 "2019-12-15T18:03:23Z")

</div>

I am wondering how I can resize the processing canvas that’s contained in my JavaFX app. Processing.java: @Override public void settings() { size(0,0,FX2D); fullScreen(); } @Override …

---

## [Changing the colour of an SVG file?](https://discourse.processing.org/t/changing-the-colour-of-an-svg-file/16338)

<div class="topic-metadata">

**Author:** [@B\_s](https://discourse.processing.org/u/B_s)\
**Replies:** 3\
**Last updated:** [December 15, 2019, 5:47pm UTC](https://discourse.processing.org/t/changing-the-colour-of-an-svg-file/16338 "2019-12-15T17:47:34Z")

</div>

Hi, I am trying to the change the colour of an svg file. I have been able to do this however it also changes the colour of some rectangle which I’m not sure why it is there. Here is a screenshot of what it looks like. Ba…

---

## [@Chrisir Clipboard functionality](https://discourse.processing.org/t/chrisir-clipboard-functionality/16421)

<div class="topic-metadata">

**Author:** [@paulgoux](https://discourse.processing.org/u/paulgoux)\
**Replies:** 1\
**Last updated:** [December 15, 2019, 5:12pm UTC](https://discourse.processing.org/t/chrisir-clipboard-functionality/16421 "2019-12-15T17:12:29Z")

</div>

Struggling a bit with some code you posted original post: // https: // forum.processing.org/two/discussion/27473/paste-and-copy-text#latest // https: // forum.processing.org/two/discussion/17270/why-this-getx-method-…

---

## [Problem in coding can't understand it](https://discourse.processing.org/t/problem-in-coding-cant-understand-it/16363)

<div class="topic-metadata">

**Author:** [@NourAdel205](https://discourse.processing.org/u/NourAdel205)\
**Replies:** 3\
**Last updated:** [December 15, 2019, 8:54am UTC](https://discourse.processing.org/t/problem-in-coding-cant-understand-it/16363 "2019-12-15T08:54:47Z")

</div>

so i coded this to allow me to make planets around the sun but it gives me error THE CODE:- planet sun; planet earth; void setup(){ size (1000,1000); sun= new planet(width/2,height/2,40,#FFBC13); earth=new planet…

---

## [Cannot make a static reference to the non-static field Bee.pos](https://discourse.processing.org/t/cannot-make-a-static-reference-to-the-non-static-field-bee-pos/16414)

<div class="topic-metadata">

**Author:** [@Wattscanaan10](https://discourse.processing.org/u/Wattscanaan10)\
**Replies:** 3\
**Last updated:** [December 15, 2019, 8:49am UTC](https://discourse.processing.org/t/cannot-make-a-static-reference-to-the-non-static-field-bee-pos/16414 "2019-12-15T08:49:11Z")

</div>

Hello, i am trying to code a program that simulates nature. I am trying to use the variable Bee.pos inside of the class Food, but when i do, it gives me “Cannot make a static reference to the non-static field Bee.pos”. A…

---

## [Vehicle-Like Movement](https://discourse.processing.org/t/vehicle-like-movement/16308)

<div class="topic-metadata">

**Author:** [@hamp](https://discourse.processing.org/u/hamp)\
**Replies:** 6\
**Last updated:** [December 15, 2019, 1:48am UTC](https://discourse.processing.org/t/vehicle-like-movement/16308 "2019-12-15T01:48:30Z")

</div>

I have a rectangle, which I want to move like a car. I can get it to move in cardinal directions, and can get it to rotate. However, I can’t seem to get it to work for me when I try and make it move in the direction it i…

---

## [3D objects render as flat, no depth/shading at all](https://discourse.processing.org/t/3d-objects-render-as-flat-no-depth-shading-at-all/16408)

<div class="topic-metadata">

**Author:** [@thejoelpatrol](https://discourse.processing.org/u/thejoelpatrol)\
**Replies:** 3\
**Last updated:** [December 15, 2019, 1:49am UTC](https://discourse.processing.org/t/3d-objects-render-as-flat-no-depth-shading-at-all/16408 "2019-12-15T01:49:34Z")

</div>

I’m having trouble figuring out why some models appear with 3D shading, as expected, and some are flat with no depth. Here’s a minimal example with two models that don’t/do work: PShape bunny; PShape ladybug; void setu…

---

## [Thread issue with while (true)](https://discourse.processing.org/t/thread-issue-with-while-true/16410)

<div class="topic-metadata">

**Author:** [@molo32](https://discourse.processing.org/u/molo32)\
**Replies:** 1\
**Last updated:** [December 15, 2019, 1:27am UTC](https://discourse.processing.org/t/thread-issue-with-while-true/16410 "2019-12-15T01:27:02Z")

</div>

when I run a while (true) inside a thread It only works if the condition play = 1 is met in the beginning. but if play = 0 in the beginning, in the future of the program when play == 1 what is inside while is not runni…

---

## [Need to get drawing under picture](https://discourse.processing.org/t/need-to-get-drawing-under-picture/16344)

<div class="topic-metadata">

**Author:** [@keeg23](https://discourse.processing.org/u/keeg23)\
**Replies:** 9\
**Last updated:** [December 14, 2019, 5:23pm UTC](https://discourse.processing.org/t/need-to-get-drawing-under-picture/16344 "2019-12-14T17:23:48Z")

</div>

The code I have now I am having trouble getting the actual drawing under the picture, was told it may be the mousepressed section but could not solve the problem thank you! PImage myElonStart, myMonroe, myLennon, select…

---

## [Calling a parents function in a child object](https://discourse.processing.org/t/calling-a-parents-function-in-a-child-object/16384)

<div class="topic-metadata">

**Author:** [@J0R1AN](https://discourse.processing.org/u/J0R1AN)\
**Replies:** 10\
**Last updated:** [December 14, 2019, 11:39am UTC](https://discourse.processing.org/t/calling-a-parents-function-in-a-child-object/16384 "2019-12-14T11:39:59Z")

</div>

Hi there, I’ve been working on a bigger project but ran into a bit of a problem when trying to organize my functions in the correct objects. The problem is that I cannot seem to call a function that is defined in a pare…

---

## [How to compare two 2d arrays and check if a value is in it](https://discourse.processing.org/t/how-to-compare-two-2d-arrays-and-check-if-a-value-is-in-it/16376)

<div class="topic-metadata">

**Author:** [@AkaiKenshi](https://discourse.processing.org/u/AkaiKenshi)\
**Replies:** 1\
**Last updated:** [December 14, 2019, 3:16am UTC](https://discourse.processing.org/t/how-to-compare-two-2d-arrays-and-check-if-a-value-is-in-it/16376 "2019-12-14T03:16:48Z")

</div>

so, i have a grid of objects and when the mouse enters they disappear, how ever when the mouse enters other object it reappears, I’ve searched for a solution in the 2D arrays, how ever I don’t understand them that much……

---

## [How can i make walls that are solid](https://discourse.processing.org/t/how-can-i-make-walls-that-are-solid/16347)

<div class="topic-metadata">

**Author:** [@Original](https://discourse.processing.org/u/Original)\
**Replies:** 3\
**Last updated:** [December 13, 2019, 4:09pm UTC](https://discourse.processing.org/t/how-can-i-make-walls-that-are-solid/16347 "2019-12-13T16:09:21Z")

</div>

I am new to processing I am making a maze where you have to press the mouse to see it and i dnt know how to make walls that have collision is there anyone that can help float x = 5; float y = 55; PImage img; void set…

---

## [Interactivity and scenes](https://discourse.processing.org/t/interactivity-and-scenes/16354)

<div class="topic-metadata">

**Author:** [@humano](https://discourse.processing.org/u/humano)\
**Replies:** 4\
**Last updated:** [December 13, 2019, 7:46am UTC](https://discourse.processing.org/t/interactivity-and-scenes/16354 "2019-12-13T07:46:58Z")

</div>

Hi everybody, I’m on the last step to finish my sketch, but losing my head with somoething I don’t get. Sketch has scene1, that lasts 5 seconds. Then, scene 2 has a button that activates animation called scene 3. Final…

---

## [Have a problem with "for" comand](https://discourse.processing.org/t/have-a-problem-with-for-comand/16337)

<div class="topic-metadata">

**Author:** [@AkaiKenshi](https://discourse.processing.org/u/AkaiKenshi)\
**Replies:** 10\
**Last updated:** [December 12, 2019, 6:20am UTC](https://discourse.processing.org/t/have-a-problem-with-for-comand/16337 "2019-12-12T06:20:27Z")

</div>

i’m trying to create a code that display a grid with squares and when you put the mouse over a square it disappears, how ever in my code when I put the mouse over a square the row and the column disappear… here is my c…

---

## [How to covert vectors to SVG paths?](https://discourse.processing.org/t/how-to-covert-vectors-to-svg-paths/15942)

<div class="topic-metadata">

**Author:** [@buria](https://discourse.processing.org/u/buria)\
**Replies:** 2\
**Last updated:** [December 12, 2019, 12:33am UTC](https://discourse.processing.org/t/how-to-covert-vectors-to-svg-paths/15942 "2019-12-12T00:33:37Z")

</div>

I’m using this sketch made by 郑越升Sen and I’m trying to export the result as PDF to work on it on Illustrator. But the lines are not paths, they’re a bunch of points. Is there a way to export curve lines as svg maintainin…

---

## [Highlighting a rect for some time](https://discourse.processing.org/t/highlighting-a-rect-for-some-time/16322)

<div class="topic-metadata">

**Author:** [@Unl3a5h3r](https://discourse.processing.org/u/Unl3a5h3r)\
**Replies:** 1\
**Last updated:** [December 11, 2019, 4:05pm UTC](https://discourse.processing.org/t/highlighting-a-rect-for-some-time/16322 "2019-12-11T16:05:39Z")

</div>

Hi, ich try to get into processing and thought I’ll programm a small game. I googled for some game ideas and found the game simon that seemed to be pretty simple to program. I have defined my colors and stored them in …

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

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