# Beginners

**URL:** https://discourse.processing.org/c/p5js/p5js-beginners/16.md?page=12

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

**Page:** 13

---

## [Collision of the player with the moving rectangles](https://discourse.processing.org/t/collision-of-the-player-with-the-moving-rectangles/21124)

<div class="topic-metadata">

**Author:** [@Nis](https://discourse.processing.org/u/Nis)\
**Replies:** 18\
**Last updated:** [May 22, 2020, 11:41am UTC](https://discourse.processing.org/t/collision-of-the-player-with-the-moving-rectangles/21124 "2020-05-22T11:41:47Z")

</div>

https://editor.p5js.org/Nis\_Collect/sketches/U0p3GjOK1 Given above is the link of my project. Someone please help me by reviewing my code and telling me that how can I confirm the collision of the player with the movin…

---

## [Help with integrating a Javascript p5 file into HTML](https://discourse.processing.org/t/help-with-integrating-a-javascript-p5-file-into-html/20962)

<div class="topic-metadata">

**Author:** [@Noaaaa](https://discourse.processing.org/u/Noaaaa)\
**Replies:** 2\
**Last updated:** [May 17, 2020, 12:35pm UTC](https://discourse.processing.org/t/help-with-integrating-a-javascript-p5-file-into-html/20962 "2020-05-17T12:35:03Z")

</div>

Just started trying to learn HTML, and I’m having trouble using a Javascript file within it. I want to use the p5.js Javascript library and I have created a canvas within a file called sketch.js. Why does only my H1 show…

---

## [What does the following syntax do? =\_=\>](https://discourse.processing.org/t/what-does-the-following-syntax-do/20927)

<div class="topic-metadata">

**Author:** [@paulgoux](https://discourse.processing.org/u/paulgoux)\
**Replies:** 4\
**Last updated:** [May 17, 2020, 3:12am UTC](https://discourse.processing.org/t/what-does-the-following-syntax-do/20927 "2020-05-17T03:12:39Z")

</div>

Looking at code from open processing and I come across this piece of code. C=0 setup=\_=\>{ createCanvas(W=720,W,WEBGL) noStroke() T=createGraphics(W,W).noStroke() texture(T) } draw=\_=\>{ C+=1e-3 background(…

---

## [Image not recognized](https://discourse.processing.org/t/image-not-recognized/20912)

<div class="topic-metadata">

**Author:** [@virtuous1](https://discourse.processing.org/u/virtuous1)\
**Replies:** 6\
**Last updated:** [May 17, 2020, 1:48am UTC](https://discourse.processing.org/t/image-not-recognized/20912 "2020-05-17T01:48:58Z")

</div>

Hello I was to create a sketch in p5js in the atom editor. As part of it I tried to upload an image and I got this error: Refused to execute script from 'http://127.0.0.1:3000/Draw-Pixel/MyGame.png' because its MIME typ…

---

## [P5.js vs p5.min.js; Which one should I use?](https://discourse.processing.org/t/p5-js-vs-p5-min-js-which-one-should-i-use/19920)

<div class="topic-metadata">

**Author:** [@Bassam](https://discourse.processing.org/u/Bassam)\
**Replies:** 7\
**Last updated:** [May 15, 2020, 5:07am UTC](https://discourse.processing.org/t/p5-js-vs-p5-min-js-which-one-should-i-use/19920 "2020-05-15T05:07:24Z")

</div>

Is there any harm in using the min version? I’m just wondering if it’ll be faster, take up less memory, be faster to download…?

---

## [Older, deleted image keeps loading instead of newer one with the same name](https://discourse.processing.org/t/older-deleted-image-keeps-loading-instead-of-newer-one-with-the-same-name/20746)

<div class="topic-metadata">

**Author:** [@Vera](https://discourse.processing.org/u/Vera)\
**Replies:** 4\
**Last updated:** [May 14, 2020, 7:22pm UTC](https://discourse.processing.org/t/older-deleted-image-keeps-loading-instead-of-newer-one-with-the-same-name/20746 "2020-05-14T19:22:22Z")

</div>

I’m using the web editor. I have an array with a number of images in it. I added a new image and I accidentally uploaded the wrong file first. Because the naming structure is related to the array, the second, right imag…

---

## [Error 502 randomly occurs when the project is shared](https://discourse.processing.org/t/error-502-randomly-occurs-when-the-project-is-shared/20028)

<div class="topic-metadata">

**Author:** [@paco06](https://discourse.processing.org/u/paco06)\
**Replies:** 1\
**Last updated:** [May 11, 2020, 10:57pm UTC](https://discourse.processing.org/t/error-502-randomly-occurs-when-the-project-is-shared/20028 "2020-05-11T22:57:52Z")

</div>

Hello I’m a P5.js newby…I developed 4 years ago a processing program and moved it to p5.js. It loads and works fine in the preview window. My problem occurs when I share the program, the program loading time increase ran…

---

## [How to work with TextBounds in instance mode](https://discourse.processing.org/t/how-to-work-with-textbounds-in-instance-mode/20654)

<div class="topic-metadata">

**Author:** [@murillazo](https://discourse.processing.org/u/murillazo)\
**Replies:** 2\
**Last updated:** [May 9, 2020, 7:23am UTC](https://discourse.processing.org/t/how-to-work-with-textbounds-in-instance-mode/20654 "2020-05-09T07:23:53Z")

</div>

Hi, I have the following problem, when I try to use textBounds on instance mode im not sure how to do it, is reporting me this error -\> Unable to get property ‘unitsPerEm’ of undefined or null reference. let name = "t…

---

## [Nested function?](https://discourse.processing.org/t/nested-function/20639)

<div class="topic-metadata">

**Author:** [@noel](https://discourse.processing.org/u/noel)\
**Replies:** 1\
**Last updated:** [May 8, 2020, 5:59pm UTC](https://discourse.processing.org/t/nested-function/20639 "2020-05-08T17:59:24Z")

</div>

I am making my first steps in P5.js, and trying to translate some js to java code, but I don’t understand the function below. It seems some nested function. How can I translate this? let particles = \[\]; function draw()…

---

## [How do I find out all the methods that are available to an object?](https://discourse.processing.org/t/how-do-i-find-out-all-the-methods-that-are-available-to-an-object/20571)

<div class="topic-metadata">

**Author:** [@Bassam](https://discourse.processing.org/u/Bassam)\
**Replies:** 2\
**Last updated:** [May 7, 2020, 1:06am UTC](https://discourse.processing.org/t/how-do-i-find-out-all-the-methods-that-are-available-to-an-object/20571 "2020-05-07T01:06:35Z")

</div>

I want to know all the methods that are part of a button or input box. The reference doesn’t list them all I think.

---

## [Javascript: Question re functions](https://discourse.processing.org/t/javascript-question-re-functions/20478)

<div class="topic-metadata">

**Author:** [@femke.blanco](https://discourse.processing.org/u/femke.blanco)\
**Replies:** 1\
**Last updated:** [May 4, 2020, 10:03pm UTC](https://discourse.processing.org/t/javascript-question-re-functions/20478 "2020-05-04T22:03:42Z")

</div>

1 - I can reference a function by its name. function funName () { //code } console.log (funName); // -\> function funName () {//code} console.log (typeof funName); // -\> function 2 - I can assign a function t…

---

## [Run p5ks sketch in specific div from string](https://discourse.processing.org/t/run-p5ks-sketch-in-specific-div-from-string/19999)

<div class="topic-metadata">

**Author:** [@anon57009815](https://discourse.processing.org/u/anon57009815)\
**Replies:** 4\
**Last updated:** [April 21, 2020, 12:16pm UTC](https://discourse.processing.org/t/run-p5ks-sketch-in-specific-div-from-string/19999 "2020-04-21T12:16:35Z")

</div>

Hello and good day. I am currently acessing a string of a small p5js project and I want to use it to run a new project in a specific div. Any quick help with this? /\*\* small project multiline string \*/ function setup…

---

## [Using createA() with a '#' instead of a url loads the current page in the web editor](https://discourse.processing.org/t/using-createa-with-a-instead-of-a-url-loads-the-current-page-in-the-web-editor/19864)

<div class="topic-metadata">

**Author:** [@Vera](https://discourse.processing.org/u/Vera)\
**Replies:** 3\
**Last updated:** [April 17, 2020, 7:50pm UTC](https://discourse.processing.org/t/using-createa-with-a-instead-of-a-url-loads-the-current-page-in-the-web-editor/19864 "2020-04-17T19:50:41Z")

</div>

I’m currently following the tutorials from The Coding Train on p5.js and I’ve run into a problem with the createA() DOM element. They are a bit older and I’m not sure if this is a bug or something I’m doing wrong… In vi…

---

## [Why does it happen?](https://discourse.processing.org/t/why-does-it-happen/19772)

<div class="topic-metadata">

**Author:** [@Orlando](https://discourse.processing.org/u/Orlando)\
**Replies:** 2\
**Last updated:** [April 14, 2020, 5:37pm UTC](https://discourse.processing.org/t/why-does-it-happen/19772 "2020-04-14T17:37:55Z")

</div>

Hello. Why my program doesn’t return the sequel 0.0, 0.1, 0.2, 0.3, 0.4, 0.5… and so on ??? Take a look: var c; function setup() { createCanvas(400, 400); c = 0; } function draw() { c += 0.1 print(c); } And t…

---

## [Problem with delay()](https://discourse.processing.org/t/problem-with-delay/19491)

<div class="topic-metadata">

**Author:** [@Velouria](https://discourse.processing.org/u/Velouria)\
**Replies:** 3\
**Last updated:** [April 7, 2020, 1:31pm UTC](https://discourse.processing.org/t/problem-with-delay/19491 "2020-04-07T13:31:51Z")

</div>

Hello, i’m trying to implement this example: https://p5js.org/reference/#/p5.Image/delay in a sketch, but when I run it i get the message “bg1.delay is not a function”. I believe my code is exactly the same as in the ex…

---

## [noStroke() affects shapes above and below](https://discourse.processing.org/t/nostroke-affects-shapes-above-and-below/19412)

<div class="topic-metadata">

**Author:** [@jrobthehuman](https://discourse.processing.org/u/jrobthehuman)\
**Replies:** 3\
**Last updated:** [April 5, 2020, 4:12pm UTC](https://discourse.processing.org/t/nostroke-affects-shapes-above-and-below/19412 "2020-04-05T16:12:40Z")

</div>

Hello everyone. Absolute beginner here, and I appreciate your help already. I’m using the Make: Getting Started with p5.js book, and I’m confused about example 3-15. Using noStroke() affects all the shapes, when I belie…

---

## [Stuck on Loading](https://discourse.processing.org/t/stuck-on-loading/19370)

<div class="topic-metadata">

**Author:** [@corisco](https://discourse.processing.org/u/corisco)\
**Replies:** 4\
**Last updated:** [April 3, 2020, 6:57pm UTC](https://discourse.processing.org/t/stuck-on-loading/19370 "2020-04-03T18:57:35Z")

</div>

Hi. I’m trying to get familiar with JS using p5.js. I downloaded p5.js complete, headed to the Get Started page and, as described, typed ellipse(50, 50, 80, 80); in my (desktop) editor to test it out. In Firefox, the…

---

## [FREE book (available soon): Drawing with code](https://discourse.processing.org/t/free-book-available-soon-drawing-with-code/19354)

<div class="topic-metadata">

**Author:** [@codeguppy](https://discourse.processing.org/u/codeguppy)\
**Replies:** 0\
**Last updated:** [April 3, 2020, 12:26am UTC](https://discourse.processing.org/t/free-book-available-soon-drawing-with-code/19354 "2020-04-03T00:26:42Z")

</div>

I start working on a FREE book with type-in mini programs intended for young coders. The book is based of course on p5.js API and is using codeguppy.com - the “no boilerplate” environment for young coders. How is workin…

---

## [Free PDF book: Creative Coding for Kids](https://discourse.processing.org/t/free-pdf-book-creative-coding-for-kids/19353)

<div class="topic-metadata">

**Author:** [@codeguppy](https://discourse.processing.org/u/codeguppy)\
**Replies:** 0\
**Last updated:** [April 3, 2020, 12:17am UTC](https://discourse.processing.org/t/free-pdf-book-creative-coding-for-kids/19353 "2020-04-03T00:17:53Z")

</div>

I just want to share with you the news about a new edition of Creative Coding for Kids book by Tariq Rashid. Tariq is an extraordinary educator with a big passion for writing. He has been nicely enough to share a free v…

---

## [Sprites in the p5 editor](https://discourse.processing.org/t/sprites-in-the-p5-editor/17451)

<div class="topic-metadata">

**Author:** [@shodai](https://discourse.processing.org/u/shodai)\
**Replies:** 6\
**Last updated:** [April 3, 2020, 12:15am UTC](https://discourse.processing.org/t/sprites-in-the-p5-editor/17451 "2020-04-03T00:15:15Z")

</div>

I am a teacher and am using p5js to teach basic coding. However, although there is a lot that can done in the editor, I was wondering if there is a way to use sprites? I have been looking at the p5play library and it see…

---

## [Separate Files Don't Work?](https://discourse.processing.org/t/separate-files-dont-work/19348)

<div class="topic-metadata">

**Author:** [@DaveDonnie](https://discourse.processing.org/u/DaveDonnie)\
**Replies:** 1\
**Last updated:** [April 2, 2020, 9:30pm UTC](https://discourse.processing.org/t/separate-files-dont-work/19348 "2020-04-02T21:30:56Z")

</div>

I was trying to replicate something from the coding train, and I made a file called block.js which looks like this: class Block { constructor(x,w) { this.x = x; this.y = height - w; this.w = w } show() { f…

---

## [P5() instance inside p5.Vector?](https://discourse.processing.org/t/p5-instance-inside-p5-vector/19330)

<div class="topic-metadata">

**Author:** [@marcg](https://discourse.processing.org/u/marcg)\
**Replies:** 4\
**Last updated:** [April 2, 2020, 7:02pm UTC](https://discourse.processing.org/t/p5-instance-inside-p5-vector/19330 "2020-04-02T19:02:56Z")

</div>

Hi there. Recently I tried optimising a project I have and I noticed something strange. The p5.Vector() object contains an instance of p5()… the whole p5() object Inside the src code I found this p5.Vector = function V…

---

## [Re-scaling image by pixel: why is r NaN?](https://discourse.processing.org/t/re-scaling-image-by-pixel-why-is-r-nan/19008)

<div class="topic-metadata">

**Author:** [@casey123](https://discourse.processing.org/u/casey123)\
**Replies:** 1\
**Last updated:** [March 25, 2020, 9:55pm UTC](https://discourse.processing.org/t/re-scaling-image-by-pixel-why-is-r-nan/19008 "2020-03-25T21:55:53Z")

</div>

I want to eventually re-scale my imported image while skewing it. Right now, I’m trying to get per pixel info but my variable “r” here is undefined in console. What am I missing? Thanks var img; var vScale = 4; functio…

---

## [How to use classes in instance mode?](https://discourse.processing.org/t/how-to-use-classes-in-instance-mode/18807)

<div class="topic-metadata">

**Author:** [@josephcscarpa](https://discourse.processing.org/u/josephcscarpa)\
**Replies:** 2\
**Last updated:** [March 23, 2020, 2:00pm UTC](https://discourse.processing.org/t/how-to-use-classes-in-instance-mode/18807 "2020-03-23T14:00:51Z")

</div>

I have two sketches that I would like to run on a single page and the only way this is possible with instance mode. I am just not sure how to incorporate classes used in those sketches in instance mode. Has anyone done t…

---

## [Error on loading local images](https://discourse.processing.org/t/error-on-loading-local-images/18855)

<div class="topic-metadata">

**Author:** [@ej8000](https://discourse.processing.org/u/ej8000)\
**Replies:** 1\
**Last updated:** [March 21, 2020, 9:13am UTC](https://discourse.processing.org/t/error-on-loading-local-images/18855 "2020-03-21T09:13:25Z")

</div>

I have in setup() img = loadImage(“download.jpg”); and in draw() image(img,0, 0); i,ve got this error(Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at file:///G:/p5/ex1/do…

---

## [Enemy x keeps equaling nan](https://discourse.processing.org/t/enemy-x-keeps-equaling-nan/18302)

<div class="topic-metadata">

**Author:** [@ctrembla](https://discourse.processing.org/u/ctrembla)\
**Replies:** 6\
**Last updated:** [March 2, 2020, 10:46pm UTC](https://discourse.processing.org/t/enemy-x-keeps-equaling-nan/18302 "2020-03-02T22:46:54Z")

</div>

I’m trying to create a tower defense game, but atm my enemy keeps vanishing & it’s x keeps showing up nan. Can anyone tell me why? sketch.js var wall = \[35\]; var bs = 25; var enemy; function preload(){ wallT = loadT…

---

## [Problem with pulling values from array of colours, strings](https://discourse.processing.org/t/problem-with-pulling-values-from-array-of-colours-strings/18267)

<div class="topic-metadata">

**Author:** [@leobrooks](https://discourse.processing.org/u/leobrooks)\
**Replies:** 9\
**Last updated:** [March 1, 2020, 7:18pm UTC](https://discourse.processing.org/t/problem-with-pulling-values-from-array-of-colours-strings/18267 "2020-03-01T19:18:45Z")

</div>

Hello, I’ve extracted my problem from a larger sketch, but the main problem is here. When I run this, the colours and letters appear alright, but I get this error: Uncaught Error: \[object Arguments\]is not a valid colo…

---

## [Help! Why I cannot use the P5JS](https://discourse.processing.org/t/help-why-i-cannot-use-the-p5js/18067)

<div class="topic-metadata">

**Author:** [@impandapasta](https://discourse.processing.org/u/impandapasta)\
**Replies:** 4\
**Last updated:** [February 27, 2020, 11:57am UTC](https://discourse.processing.org/t/help-why-i-cannot-use-the-p5js/18067 "2020-02-27T11:57:10Z")

</div>

I’m learning my Coursera courses about P5JS and I downloaded it ,however when I opened the sketch.js, (I didn’t do anything before open it .) I found there always have many errors… and when I tried to open the index.h…

---

## [Tutorial on Easing](https://discourse.processing.org/t/tutorial-on-easing/18011)

<div class="topic-metadata">

**Author:** [@hessa](https://discourse.processing.org/u/hessa)\
**Replies:** 2\
**Last updated:** [February 22, 2020, 3:33pm UTC](https://discourse.processing.org/t/tutorial-on-easing/18011 "2020-02-22T15:33:05Z")

</div>

Theres an easing example on p5js that i would love to make my own but i’m not completely sure how easing works. Can anyone explain how easing works? like why we’re defining these variables and what each of them do? that …

---

## [Variable must change from 3.67 to 3.15](https://discourse.processing.org/t/variable-must-change-from-3-67-to-3-15/17929)

<div class="topic-metadata">

**Author:** [@JochemTD](https://discourse.processing.org/u/JochemTD)\
**Replies:** 3\
**Last updated:** [February 19, 2020, 6:14pm UTC](https://discourse.processing.org/t/variable-must-change-from-3-67-to-3-15/17929 "2020-02-19T18:14:08Z")

</div>

Hi there! I need my variable i to go from 3.67 to 3.15 to 3.67 to 3.15 to 3.67 and so on. I’m able to do this just fine from 3.67 to 3.15, however I can’t manage to let it go back to 3.67. This is the code i’m using rig…

[Previous page](https://discourse.processing.org/c/p5js/p5js-beginners/16.md?page=11)

[Next page](https://discourse.processing.org/c/p5js/p5js-beginners/16.md?page=13)
