# Coding Questions

**URL:** https://discourse.processing.org/c/p5js/p5js-questions/18.md?page=52

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

**Page:** 53

---

## [How to make the game continue playing, not just playing once](https://discourse.processing.org/t/how-to-make-the-game-continue-playing-not-just-playing-once/4215)

<div class="topic-metadata">

**Author:** [@applelovestree](https://discourse.processing.org/u/applelovestree)\
**Replies:** 6\
**Last updated:** [October 7, 2018, 10:41pm UTC](https://discourse.processing.org/t/how-to-make-the-game-continue-playing-not-just-playing-once/4215 "2018-10-07T22:41:55Z")

</div>

At the moment, the red color circle can be played only once, can the game continue to play maybe for 1 minute, then it will stop and show the scores? And when the following game continues, so the answer to the game will …

---

## [Neural network not working (Dan Shiffman, The Nature of Code 10)](https://discourse.processing.org/t/neural-network-not-working-dan-shiffman-the-nature-of-code-10/4226)

<div class="topic-metadata">

**Author:** [@adeleonardis](https://discourse.processing.org/u/adeleonardis)\
**Replies:** 3\
**Last updated:** [October 7, 2018, 9:01pm UTC](https://discourse.processing.org/t/neural-network-not-working-dan-shiffman-the-nature-of-code-10/4226 "2018-10-07T21:01:05Z")

</div>

Hello. I was following along with Dan’s Youtube series on neural networks and even though I’m only a beginner decided to write it with the added functionality of having multiple hidden layers instead of copying exactly w…

---

## [P5.dom.js 'createElement' function not able to set properties?](https://discourse.processing.org/t/p5-dom-js-createelement-function-not-able-to-set-properties/4196)

<div class="topic-metadata">

**Author:** [@repgainer3](https://discourse.processing.org/u/repgainer3)\
**Replies:** 4\
**Last updated:** [October 6, 2018, 7:04pm UTC](https://discourse.processing.org/t/p5-dom-js-createelement-function-not-able-to-set-properties/4196 "2018-10-06T19:04:57Z")

</div>

Hi, I’m building a forum site from scratch and I’m using the p5.dom.js library to speed up the process. I’m attempting to create a TR tag and three TD tags that go inside the TR, after that I want the TR to go inside of…

---

## [How to make and load personnal JSON file](https://discourse.processing.org/t/how-to-make-and-load-personnal-json-file/4191)

<div class="topic-metadata">

**Author:** [@mloiz](https://discourse.processing.org/u/mloiz)\
**Replies:** 1\
**Last updated:** [October 6, 2018, 6:02pm UTC](https://discourse.processing.org/t/how-to-make-and-load-personnal-json-file/4191 "2018-10-06T18:02:07Z")

</div>

Hi, I wanted to work with my own json data file, but it did not finish loading … :confused: the html page thanks

---

## [Creating arrays of colors](https://discourse.processing.org/t/creating-arrays-of-colors/4180)

<div class="topic-metadata">

**Author:** [@ducco](https://discourse.processing.org/u/ducco)\
**Replies:** 4\
**Last updated:** [October 6, 2018, 8:46am UTC](https://discourse.processing.org/t/creating-arrays-of-colors/4180 "2018-10-06T08:46:23Z")

</div>

hi im trying to make an array in p5js of colors and defining them individually in setup and i always get the error “undefined is an invalid colorMode.” and i cant figure out why or find any specific documentation on defi…

---

## [P5.js tint() Memory Error](https://discourse.processing.org/t/p5-js-tint-memory-error/4134)

<div class="topic-metadata">

**Author:** [@currymike](https://discourse.processing.org/u/currymike)\
**Replies:** 6\
**Last updated:** [October 5, 2018, 3:11pm UTC](https://discourse.processing.org/t/p5-js-tint-memory-error/4134 "2018-10-05T15:11:08Z")

</div>

I’m running an app I just built on safari mobile and I’m getting some strange errors. I’m loading the p5.js & p5.sound libraries but at the moment I’m not using any of p5.sound in my code. That would be added later. I…

---

## [Forcing Redirect in p5](https://discourse.processing.org/t/forcing-redirect-in-p5/4154)

<div class="topic-metadata">

**Author:** [@dorf](https://discourse.processing.org/u/dorf)\
**Replies:** 1\
**Last updated:** [October 5, 2018, 5:07am UTC](https://discourse.processing.org/t/forcing-redirect-in-p5/4154 "2018-10-05T05:07:48Z")

</div>

Hey everybody! This is my first post here and in any real coding forum so I apologize if I come off very amateur (it’s because I am). I am having an issue where for a project I would like to hit the enter key and be imme…

---

## [Simultaneous keys press at the same time?](https://discourse.processing.org/t/simultaneous-keys-press-at-the-same-time/4105)

<div class="topic-metadata">

**Author:** [@zng](https://discourse.processing.org/u/zng)\
**Replies:** 6\
**Last updated:** [October 4, 2018, 3:31am UTC](https://discourse.processing.org/t/simultaneous-keys-press-at-the-same-time/4105 "2018-10-04T03:31:48Z")

</div>

Hi, I am actually pretty new to the concept of programming so forgive me if I sound kinda dumb. I am trying to make a game using p5 and the p5 dom where there is 6 image randomiser(think slot machine) and each image is …

---

## [Help optimizing a p5.js type generator](https://discourse.processing.org/t/help-optimizing-a-p5-js-type-generator/3941)

<div class="topic-metadata">

**Author:** [@kiel.d.m](https://discourse.processing.org/u/kiel.d.m)\
**Replies:** 5\
**Last updated:** [October 3, 2018, 11:55pm UTC](https://discourse.processing.org/t/help-optimizing-a-p5-js-type-generator/3941 "2018-10-03T23:55:49Z")

</div>

I’m trying to translate a project I made in Processing (here) into a browser environment with P5.js. It works smoothly until additional rings are added (, after which it really starts to slow down. Here’s the initial, st…

---

## [How to get balls to bounce off each other in p5.js?](https://discourse.processing.org/t/how-to-get-balls-to-bounce-off-each-other-in-p5-js/4082)

<div class="topic-metadata">

**Author:** [@BLy](https://discourse.processing.org/u/BLy)\
**Replies:** 2\
**Last updated:** [October 3, 2018, 7:29pm UTC](https://discourse.processing.org/t/how-to-get-balls-to-bounce-off-each-other-in-p5-js/4082 "2018-10-03T19:29:46Z")

</div>

I’m having trouble getting these balls to bounce off one another; they keep getting stuck in certain parts as well. If someone could please help me with the code, it would be much appreciated! I am relatively new to usin…

---

## [Unable to shorten strings](https://discourse.processing.org/t/unable-to-shorten-strings/4046)

<div class="topic-metadata">

**Author:** [@desk](https://discourse.processing.org/u/desk)\
**Replies:** 9\
**Last updated:** [October 3, 2018, 6:18am UTC](https://discourse.processing.org/t/unable-to-shorten-strings/4046 "2018-10-03T06:18:08Z")

</div>

This seems like a simple problem… but it has been driving me nuts! var bob = ''; function setup() { } function draw() { } function keyTyped() { bob += key; print(bob); } function keyPressed() { if(keyCode ==…

---

## [createCapture() constraints and facingMode](https://discourse.processing.org/t/createcapture-constraints-and-facingmode/3960)

<div class="topic-metadata">

**Author:** [@tony](https://discourse.processing.org/u/tony)\
**Replies:** 2\
**Last updated:** [October 1, 2018, 7:17pm UTC](https://discourse.processing.org/t/createcapture-constraints-and-facingmode/3960 "2018-10-01T19:17:20Z")

</div>

Are there any resources out there that clearly list all the possible constraints you can apply to createCapture()? All they do is redirect you to this page: https://w3c.github.io/mediacapture-main/getusermedia.html#med…

---

## [Make two objects interacting with each other](https://discourse.processing.org/t/make-two-objects-interacting-with-each-other/3843)

<div class="topic-metadata">

**Author:** [@JimyiHendrix](https://discourse.processing.org/u/JimyiHendrix)\
**Replies:** 3\
**Last updated:** [September 29, 2018, 10:46am UTC](https://discourse.processing.org/t/make-two-objects-interacting-with-each-other/3843 "2018-09-29T10:46:08Z")

</div>

Hello everyone!! i’m new in this of programming but i am trying to learn by making this sort of codes. I would like the ball and the wall1 interact each other making the ball bounce on the brick. May somebody guide me,…

---

## [Loading a client text file into a String array](https://discourse.processing.org/t/loading-a-client-text-file-into-a-string-array/3947)

<div class="topic-metadata">

**Author:** [@desk](https://discourse.processing.org/u/desk)\
**Replies:** 2\
**Last updated:** [September 29, 2018, 6:23am UTC](https://discourse.processing.org/t/loading-a-client-text-file-into-a-string-array/3947 "2018-09-29T06:23:23Z")

</div>

I’m a bit new to js. I’m not sure how to load a file. The following code does not work. input2 = createFileInput(handleFile2); input2.position(width/2, height/2); function handleFile2(file) { var lines = loadStri…

---

## [Video data size limit error](https://discourse.processing.org/t/video-data-size-limit-error/3769)

<div class="topic-metadata">

**Author:** [@desk](https://discourse.processing.org/u/desk)\
**Replies:** 8\
**Last updated:** [September 29, 2018, 3:40am UTC](https://discourse.processing.org/t/video-data-size-limit-error/3769 "2018-09-29T03:40:09Z")

</div>

I am running into an error when attempting to load video which is around 200MB in size. allocation size overflow p5.dom.js:807:15 The error doesn’t occur with small videos. please help, thanks

---

## [Image processing of webcam video (dithering)](https://discourse.processing.org/t/image-processing-of-webcam-video-dithering/3904)

<div class="topic-metadata">

**Author:** [@gramalam](https://discourse.processing.org/u/gramalam)\
**Replies:** 3\
**Last updated:** [September 28, 2018, 6:58pm UTC](https://discourse.processing.org/t/image-processing-of-webcam-video-dithering/3904 "2018-09-28T18:58:58Z")

</div>

hello! I am hoping to get someone to look at what I’ve written and help me troubleshoot. below is a link to the sketch written in the web editor, with a goal of applying a dithering effect to streamed video from a webca…

---

## [Strange ball behaviour](https://discourse.processing.org/t/strange-ball-behaviour/3931)

<div class="topic-metadata">

**Author:** [@Alexstrinda](https://discourse.processing.org/u/Alexstrinda)\
**Replies:** 1\
**Last updated:** [September 28, 2018, 12:06pm UTC](https://discourse.processing.org/t/strange-ball-behaviour/3931 "2018-09-28T12:06:34Z")

</div>

I wrote a very simple code that doesn’t work as expected. I could have fixed it with a patch or something similar, however, I am really interested in the logical flaw that leads to the problem. The issue is that the bal…

---

## [Is it possible to mix vertex() and curveVertex() in one shape yet?](https://discourse.processing.org/t/is-it-possible-to-mix-vertex-and-curvevertex-in-one-shape-yet/3830)

<div class="topic-metadata">

**Author:** [@adamherst](https://discourse.processing.org/u/adamherst)\
**Replies:** 0\
**Last updated:** [September 25, 2018, 2:34pm UTC](https://discourse.processing.org/t/is-it-possible-to-mix-vertex-and-curvevertex-in-one-shape-yet/3830 "2018-09-25T14:34:29Z")

</div>

I’ve found an old discussion saying that this is possible in processing but wasn’t possible in p5 (https://github.com/processing/p5.js/issues/906). I also think I found a discussion saying that a patch for this had been…

---

## [I am unable to properly rotate](https://discourse.processing.org/t/i-am-unable-to-properly-rotate/3737)

<div class="topic-metadata">

**Author:** [@willianxz](https://discourse.processing.org/u/willianxz)\
**Replies:** 4\
**Last updated:** [September 25, 2018, 2:06am UTC](https://discourse.processing.org/t/i-am-unable-to-properly-rotate/3737 "2018-09-25T02:06:43Z")

</div>

Hello my friends, I am trying to apply the rotation technique of my drawing, but I am not able to make the drawing rotate without leaving the place. I remember that to effect this technique I have to pass the width / 2 …

---

## [Can u help me with my code?](https://discourse.processing.org/t/can-u-help-me-with-my-code/3770)

<div class="topic-metadata">

**Author:** [@Blue\_Obsidian](https://discourse.processing.org/u/Blue_Obsidian)\
**Replies:** 1\
**Last updated:** [September 23, 2018, 5:07pm UTC](https://discourse.processing.org/t/can-u-help-me-with-my-code/3770 "2018-09-23T17:07:45Z")

</div>

The collisions don’t work and I don’t know why, here’s the link (the condition in checkCollisions doesn’t turn to true): https://editor.p5js.org/Dark\_Obsidian/sketches/SykuR3fKm

---

## [\[SOLVED\] Setting PGraphics background in setup() causes NullPointerException?](https://discourse.processing.org/t/solved-setting-pgraphics-background-in-setup-causes-nullpointerexception/3736)

<div class="topic-metadata">

**Author:** [@aaronshenhao](https://discourse.processing.org/u/aaronshenhao)\
**Replies:** 1\
**Last updated:** [September 22, 2018, 1:35pm UTC](https://discourse.processing.org/t/solved-setting-pgraphics-background-in-setup-causes-nullpointerexception/3736 "2018-09-22T13:35:00Z")

</div>

I’m using the Java version for Processing and I’ve been following a tutorial on PGraphics which uses p5.js. At one point, they initialize the background for the PGraphics layer in setup. However, when I try it, it produc…

---

## [How can I make the depth map of text using white lines on a black background in the web browser?](https://discourse.processing.org/t/how-can-i-make-the-depth-map-of-text-using-white-lines-on-a-black-background-in-the-web-browser/3617)

<div class="topic-metadata">

**Author:** [@seppe](https://discourse.processing.org/u/seppe)\
**Replies:** 5\
**Last updated:** [September 18, 2018, 4:14am UTC](https://discourse.processing.org/t/how-can-i-make-the-depth-map-of-text-using-white-lines-on-a-black-background-in-the-web-browser/3617 "2018-09-18T04:14:37Z")

</div>

So I found a really cool processing sketch here (https://www.flickr.com/photos/jegb70/2218491686) that I would like to recreate in the browser, either using processing.js, p5.js, or some other form that would allow me to…

---

## [How can I extend the context to add globalcompositeoperation = 'destination-out'?](https://discourse.processing.org/t/how-can-i-extend-the-context-to-add-globalcompositeoperation-destination-out/3586)

<div class="topic-metadata">

**Author:** [@lgdelacruz](https://discourse.processing.org/u/lgdelacruz)\
**Replies:** 1\
**Last updated:** [September 17, 2018, 2:40am UTC](https://discourse.processing.org/t/how-can-i-extend-the-context-to-add-globalcompositeoperation-destination-out/3586 "2018-09-17T02:40:44Z")

</div>

I’m trying to create a draw with pencil and eraser. I really want to make use of setting the context in Render2D.globalcompositeoperation = ‘destination-out’ in order to create an erasing the line behavior. How would I g…

---

## [Does set() work differently in P5.JS than it does in Processing?](https://discourse.processing.org/t/does-set-work-differently-in-p5-js-than-it-does-in-processing/3570)

<div class="topic-metadata">

**Author:** [@HoboGreed](https://discourse.processing.org/u/HoboGreed)\
**Replies:** 1\
**Last updated:** [September 16, 2018, 11:48am UTC](https://discourse.processing.org/t/does-set-work-differently-in-p5-js-than-it-does-in-processing/3570 "2018-09-16T11:48:10Z")

</div>

point(250,250) draws a point but set(250,250,255) does not. function setup() { createCanvas(500,500); } function draw() { background(0); stroke(255); point(250,250); set(252,250,255) }

---

## [P5 Pathfinding Function Crashes Sketch](https://discourse.processing.org/t/p5-pathfinding-function-crashes-sketch/3524)

<div class="topic-metadata">

**Author:** [@OrangeC7](https://discourse.processing.org/u/OrangeC7)\
**Replies:** 3\
**Last updated:** [September 14, 2018, 5:46am UTC](https://discourse.processing.org/t/p5-pathfinding-function-crashes-sketch/3524 "2018-09-14T05:46:30Z")

</div>

I’m trying to write an A\* pathfinding function to see how well it does in a snake game I’m programming based on The Coding Train’s coding challenge here: (https://www.youtube.com/watch?v=OMoVcohRgZA), but for some reason…

---

## [Reading XML data from website](https://discourse.processing.org/t/reading-xml-data-from-website/3500)

<div class="topic-metadata">

**Author:** [@specials](https://discourse.processing.org/u/specials)\
**Replies:** 3\
**Last updated:** [September 13, 2018, 8:22pm UTC](https://discourse.processing.org/t/reading-xml-data-from-website/3500 "2018-09-13T20:22:31Z")

</div>

I am attempting to read the product page of a certain website, however I get an error on line 27, stating that goXML does not have a function named listChildren, along with all other p5 .xml functions. However, xml, a va…

---

## [Perlin noise implementation in p5.js](https://discourse.processing.org/t/perlin-noise-implementation-in-p5-js/3009)

<div class="topic-metadata">

**Author:** [@HEX0x6C](https://discourse.processing.org/u/HEX0x6C)\
**Replies:** 14\
**Last updated:** [September 12, 2018, 8:20pm UTC](https://discourse.processing.org/t/perlin-noise-implementation-in-p5-js/3009 "2018-09-12T20:20:46Z")

</div>

Hi. I noticed the outcomes of noise() function in Processing and p5.js is different (setting the same seeds). Do they use different implementations? Why?

---

## [Euler angles, while working on a flight simulator](https://discourse.processing.org/t/euler-angles-while-working-on-a-flight-simulator/3441)

<div class="topic-metadata">

**Author:** [@EMJ](https://discourse.processing.org/u/EMJ)\
**Replies:** 8\
**Last updated:** [September 12, 2018, 7:43pm UTC](https://discourse.processing.org/t/euler-angles-while-working-on-a-flight-simulator/3441 "2018-09-12T19:43:33Z")

</div>

Hi all, i’m quite a beginner, more in 3d level math than in coding (i’m not so confident in my english too), and i’m trying to build from scratch a working flight simulator, not with amazing graphics, just for now a 3d m…

---

## [netP5 (TCP/IP networking under android)](https://discourse.processing.org/t/netp5-tcp-ip-networking-under-android/3046)

<div class="topic-metadata">

**Author:** [@dtmr](https://discourse.processing.org/u/dtmr)\
**Replies:** 0\
**Last updated:** [August 27, 2018, 11:50pm UTC](https://discourse.processing.org/t/netp5-tcp-ip-networking-under-android/3046 "2018-08-27T23:50:00Z")

</div>

netP5 problem: The code below only works with the delay, otherwise the Client.send() operation throws a null pointer exception. Should I check/wait for something after creating a client? Client = new TcpClient(Listener,…

---

## [P5.js image width and height error](https://discourse.processing.org/t/p5-js-image-width-and-height-error/3345)

<div class="topic-metadata">

**Author:** [@josephh](https://discourse.processing.org/u/josephh)\
**Replies:** 4\
**Last updated:** [September 7, 2018, 3:25pm UTC](https://discourse.processing.org/t/p5-js-image-width-and-height-error/3345 "2018-09-07T15:25:54Z")

</div>

Hello there, Basically I want to load some images (in the folder pics/n\*.jpg) and get their pixel data in a 2d array (data = \[\]). I have this code : let data = \[\]; let img; function preload() { for (let i = 0; i \<…

[Previous page](https://discourse.processing.org/c/p5js/p5js-questions/18.md?page=51)

[Next page](https://discourse.processing.org/c/p5js/p5js-questions/18.md?page=53)
