# Coding Questions

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

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

**Page:** 66

---

## [Write lines in random sizes one below the other](https://discourse.processing.org/t/write-lines-in-random-sizes-one-below-the-other/27139)

<div class="topic-metadata">

**Author:** [@Ida](https://discourse.processing.org/u/Ida)\
**Replies:** 4\
**Last updated:** [January 17, 2021, 5:28pm UTC](https://discourse.processing.org/t/write-lines-in-random-sizes-one-below-the-other/27139 "2021-01-17T17:28:40Z")

</div>

Hey, I am having trouble with my code. I split my text into lines, which should be drawn in random sizes to the screen. Now, there are two problems: First of all splitTokens deletes all my delimiters, but also ', – and …

---

## [Creating collision with unusual shapes](https://discourse.processing.org/t/creating-collision-with-unusual-shapes/27142)

<div class="topic-metadata">

**Author:** [@DeidaraLP](https://discourse.processing.org/u/DeidaraLP)\
**Replies:** 2\
**Last updated:** [January 17, 2021, 12:49pm UTC](https://discourse.processing.org/t/creating-collision-with-unusual-shapes/27142 "2021-01-17T12:49:12Z")

</div>

Hello. Im currently working on my first processing project, and im trying to create a very simple game. In the game you move an airplane with your mouse and have to avoid projectiles coming towards you. The airplane is …

---

## [Apply methods to a specific object from ArrayList/indexes question](https://discourse.processing.org/t/apply-methods-to-a-specific-object-from-arraylist-indexes-question/27135)

<div class="topic-metadata">

**Author:** [@Elmpt](https://discourse.processing.org/u/Elmpt)\
**Replies:** 1\
**Last updated:** [January 17, 2021, 9:44am UTC](https://discourse.processing.org/t/apply-methods-to-a-specific-object-from-arraylist-indexes-question/27135 "2021-01-17T09:44:09Z")

</div>

Good morning, everyone! I have a new question regarding processing programming. What I am working on: I have an image object that is resized by user, then there is a lot of logic defining what happens with the object n…

---

## [How get image clipboard to PImage](https://discourse.processing.org/t/how-get-image-clipboard-to-pimage/27129)

<div class="topic-metadata">

**Author:** [@molo32](https://discourse.processing.org/u/molo32)\
**Replies:** 0\
**Last updated:** [January 17, 2021, 3:07am UTC](https://discourse.processing.org/t/how-get-image-clipboard-to-pimage/27129 "2021-01-17T03:07:13Z")

</div>

I have this code to get an image from the clipboard when pressing imprt. but it returns Image how do I convert it to PImage? public Image getImageFromClipboard( ) { Transferable transferable = Toolkit.getDefaultToolk…

---

## [Intersecting objects in a processing game](https://discourse.processing.org/t/intersecting-objects-in-a-processing-game/27117)

<div class="topic-metadata">

**Author:** [@tryingtocode](https://discourse.processing.org/u/tryingtocode)\
**Replies:** 1\
**Last updated:** [January 17, 2021, 1:04am UTC](https://discourse.processing.org/t/intersecting-objects-in-a-processing-game/27117 "2021-01-17T01:04:03Z")

</div>

I’m making a game, in which when the asteroid hits the spaceship the image should be portrayed on the screen. Below the whole code I pasted a loop, which is wrong and I have no idea how to fix it in order to make the int…

---

## [Some problems with 2d array](https://discourse.processing.org/t/some-problems-with-2d-array/27109)

<div class="topic-metadata">

**Author:** [@deiwy](https://discourse.processing.org/u/deiwy)\
**Replies:** 4\
**Last updated:** [January 16, 2021, 2:01pm UTC](https://discourse.processing.org/t/some-problems-with-2d-array/27109 "2021-01-16T14:01:08Z")

</div>

i create 2d array of map, to create a platformer game, and map is not render correctly platform pl; FloatList plx, ply; int\[\]\[\] map = { {0, 1, 1, 0}, {0, 0, 0, 1}, {0, 1, 1, 0}, {0, 0, 0, 1} }; void setup(…

---

## [Change Image object size with mouse](https://discourse.processing.org/t/change-image-object-size-with-mouse/27077)

<div class="topic-metadata">

**Author:** [@Elmpt](https://discourse.processing.org/u/Elmpt)\
**Replies:** 3\
**Last updated:** [January 16, 2021, 1:42pm UTC](https://discourse.processing.org/t/change-image-object-size-with-mouse/27077 "2021-01-16T13:42:55Z")

</div>

Hi! I’m here again with the question. I have an image object that I would like to display firstly small, but I want that when the user clicks and holds mouse pressed on the image and than starts to move mouse, the image…

---

## [Fast image cropping in Processing](https://discourse.processing.org/t/fast-image-cropping-in-processing/27091)

<div class="topic-metadata">

**Author:** [@r.jaoui](https://discourse.processing.org/u/r.jaoui)\
**Replies:** 6\
**Last updated:** [January 16, 2021, 12:34pm UTC](https://discourse.processing.org/t/fast-image-cropping-in-processing/27091 "2021-01-16T12:34:09Z")

</div>

Hello ! I am currently working on a project that is quite large and I would like to optimize parts of it as soon as possible. In the course of this project, I need to crop some quite large images (around 2K) to a size …

---

## [Limit window maximum size](https://discourse.processing.org/t/limit-window-maximum-size/27076)

<div class="topic-metadata">

**Author:** [@mgood7123](https://discourse.processing.org/u/mgood7123)\
**Replies:** 5\
**Last updated:** [January 16, 2021, 11:24am UTC](https://discourse.processing.org/t/limit-window-maximum-size/27076 "2021-01-16T11:24:21Z")

</div>

is there a way to set a maximum window size? in particular I am trying to prevent content overflow by limiting the maximum window size void setup() { // initial window size size(640, 360, P2D); // allow window t…

---

## [Image resetting after moving](https://discourse.processing.org/t/image-resetting-after-moving/27097)

<div class="topic-metadata">

**Author:** [@lancelot](https://discourse.processing.org/u/lancelot)\
**Replies:** 2\
**Last updated:** [January 16, 2021, 8:54am UTC](https://discourse.processing.org/t/image-resetting-after-moving/27097 "2021-01-16T08:54:13Z")

</div>

Hi everyone, I’ve been creating a map with a 2d array, and now i’m trying to get it to move (since the map is bigger than the screen), but I’m having some trouble with getting the field to stay where it is. The idea beh…

---

## [Make trail move in Z direction](https://discourse.processing.org/t/make-trail-move-in-z-direction/27037)

<div class="topic-metadata">

**Author:** [@noobcoder](https://discourse.processing.org/u/noobcoder)\
**Replies:** 12\
**Last updated:** [January 16, 2021, 8:10am UTC](https://discourse.processing.org/t/make-trail-move-in-z-direction/27037 "2021-01-16T08:10:04Z")

</div>

I am trying to set up an interaction between AntD and the trail it leaves behind. I want the trail to move up in the Z direction every time the AntD come within a certain distance of the trail. Right now i have just adde…

---

## [Ball to ball collision](https://discourse.processing.org/t/ball-to-ball-collision/27050)

<div class="topic-metadata">

**Author:** [@WasNeverHere](https://discourse.processing.org/u/WasNeverHere)\
**Replies:** 1\
**Last updated:** [January 15, 2021, 1:20pm UTC](https://discourse.processing.org/t/ball-to-ball-collision/27050 "2021-01-15T13:20:16Z")

</div>

I am trying to make it so that the circle that is moving (circleX) isn’t hit by the circles that are obstacles (circleD). I’ve tried a lot of different things and can’t find what’s wrong. float xspeed = 2.5; float x,y; …

---

## [Line Graph - ArrayIndexOutOfBoundsException: 570](https://discourse.processing.org/t/line-graph-arrayindexoutofboundsexception-570/27085)

<div class="topic-metadata">

**Author:** [@JennyMcCreadie](https://discourse.processing.org/u/JennyMcCreadie)\
**Replies:** 4\
**Last updated:** [January 15, 2021, 12:20pm UTC](https://discourse.processing.org/t/line-graph-arrayindexoutofboundsexception-570/27085 "2021-01-15T12:20:17Z")

</div>

Hello, I’m following a tutorial on making a dynamic linegraph whilst using my own data. I’ve come across an error which I’m unable to fix myself and would really appreciate some fresh eyes on this :slight\_smile: I know …

---

## [PGraphics - read pixels as they are drawn](https://discourse.processing.org/t/pgraphics-read-pixels-as-they-are-drawn/21837)

<div class="topic-metadata">

**Author:** [@mgood7123](https://discourse.processing.org/u/mgood7123)\
**Replies:** 21\
**Last updated:** [January 15, 2021, 6:28am UTC](https://discourse.processing.org/t/pgraphics-read-pixels-as-they-are-drawn/21837 "2021-01-15T06:28:10Z")

</div>

with the PGraphics class, is there a way to read pixles as they get drawn? for example PGraphics c; void settings() { size(100, 100, P3D); } void setup() { c = createGraphics(100,100, P3D); c.beginDraw();…

---

## [\*URGENT\* Assistance with Drawing Program](https://discourse.processing.org/t/urgent-assistance-with-drawing-program/27046)

<div class="topic-metadata">

**Author:** [@Prxt.3k](https://discourse.processing.org/u/Prxt.3k)\
**Replies:** 11\
**Last updated:** [January 14, 2021, 6:45pm UTC](https://discourse.processing.org/t/urgent-assistance-with-drawing-program/27046 "2021-01-14T18:45:20Z")

</div>

I am creating a drawing program similar to paint for a school assignment, but I would like to know if someone has the code for the shape selector box similar to Microsoft paint because I would like to elevate my project.…

---

## [Creating a list of random colors that does not update](https://discourse.processing.org/t/creating-a-list-of-random-colors-that-does-not-update/27041)

<div class="topic-metadata">

**Author:** [@jackeddielove](https://discourse.processing.org/u/jackeddielove)\
**Replies:** 7\
**Last updated:** [January 14, 2021, 3:56pm UTC](https://discourse.processing.org/t/creating-a-list-of-random-colors-that-does-not-update/27041 "2021-01-14T15:56:12Z")

</div>

I would like to create an array of 100 randomly chosen colors that I can pick from throughout my “draw” code. If I use color\[\] colors = new color\[100\]; for (int i = 0; i\<100; i++) { colors\[i\]= color(random(255), rand…

---

## [Finding the edges in an Image error](https://discourse.processing.org/t/finding-the-edges-in-an-image-error/27055)

<div class="topic-metadata">

**Author:** [@ELaN](https://discourse.processing.org/u/ELaN)\
**Replies:** 11\
**Last updated:** [January 14, 2021, 2:18pm UTC](https://discourse.processing.org/t/finding-the-edges-in-an-image-error/27055 "2021-01-14T14:18:49Z")

</div>

I’ve written this code to find the edges in my image which I have named properly in the correct file: \<PImage frog; void setup(){ size(1200,720); frog=loadImage(“frog.jpg”); } void draw(){ loadPixels(); frog.load…

---

## [How can I fix my Timer Bug?](https://discourse.processing.org/t/how-can-i-fix-my-timer-bug/27044)

<div class="topic-metadata">

**Author:** [@Radioaktiv](https://discourse.processing.org/u/Radioaktiv)\
**Replies:** 2\
**Last updated:** [January 14, 2021, 9:50am UTC](https://discourse.processing.org/t/how-can-i-fix-my-timer-bug/27044 "2021-01-14T09:50:16Z")

</div>

the first second the timer does not work. is there any way to fix it? also is there a way to make it mor compact? String milliseconds; int second; int timer; int index; void setup() { size(500, 500); } void draw() {…

---

## [Nature of Code: Drag Forces](https://discourse.processing.org/t/nature-of-code-drag-forces/27005)

<div class="topic-metadata">

**Author:** [@Divitiacus](https://discourse.processing.org/u/Divitiacus)\
**Replies:** 2\
**Last updated:** [January 13, 2021, 1:14pm UTC](https://discourse.processing.org/t/nature-of-code-drag-forces/27005 "2021-01-13T13:14:38Z")

</div>

This might be more a physics question then a programming question but because it is described in “The Nature of Code” somebody might have an answer as well. I am currently working on something, where I want to implement…

---

## [How are PShape contours stored?](https://discourse.processing.org/t/how-are-pshape-contours-stored/26997)

<div class="topic-metadata">

**Author:** [@micycle](https://discourse.processing.org/u/micycle)\
**Replies:** 2\
**Last updated:** [January 12, 2021, 8:38pm UTC](https://discourse.processing.org/t/how-are-pshape-contours-stored/26997 "2021-01-12T20:38:13Z")

</div>

Take the PShape above. Clearly it must know that the vertices of the inner region are not to be joined with the other vertices of the edge and represent a region that is “cut-out” from the shape. Processing calls such …

---

## [Put a picture on the walls of a box](https://discourse.processing.org/t/put-a-picture-on-the-walls-of-a-box/26919)

<div class="topic-metadata">

**Author:** [@julieturin](https://discourse.processing.org/u/julieturin)\
**Replies:** 1\
**Last updated:** [January 12, 2021, 7:20pm UTC](https://discourse.processing.org/t/put-a-picture-on-the-walls-of-a-box/26919 "2021-01-12T19:20:47Z")

</div>

hello, I would like to put a picture on the floor and walls of my box but I can’t do it with vertex. pushMatrix(); translate(0, 0, total/2); box(400, 200, total); PImage img = loadImage(“lol.jpg”); noStroke(); beg…

---

## [Compare data with recorded data](https://discourse.processing.org/t/compare-data-with-recorded-data/26922)

<div class="topic-metadata">

**Author:** [@bking](https://discourse.processing.org/u/bking)\
**Replies:** 3\
**Last updated:** [January 12, 2021, 12:22am UTC](https://discourse.processing.org/t/compare-data-with-recorded-data/26922 "2021-01-12T00:22:28Z")

</div>

I would like just to compare a value of a data that I have at the actual frame, with the former value I had at the previous frame. And do something like this if (formerData \> actualData+100) doSomething. Thank you. …

---

## [Compare the same data at the same frame](https://discourse.processing.org/t/compare-the-same-data-at-the-same-frame/26987)

<div class="topic-metadata">

**Author:** [@bking](https://discourse.processing.org/u/bking)\
**Replies:** 0\
**Last updated:** [January 11, 2021, 9:16pm UTC](https://discourse.processing.org/t/compare-the-same-data-at-the-same-frame/26987 "2021-01-11T21:16:24Z")

</div>

Hello! I don’t understand why my program record the same value whereas it shouldn’t? I want to record 3 different datas with 1 different frame each time one of my three value is different. I think, I compare datas not…

---

## [Stack boxes (questions / Tetris)](https://discourse.processing.org/t/stack-boxes-questions-tetris/26981)

<div class="topic-metadata">

**Author:** [@jeremy](https://discourse.processing.org/u/jeremy)\
**Replies:** 5\
**Last updated:** [January 11, 2021, 7:01pm UTC](https://discourse.processing.org/t/stack-boxes-questions-tetris/26981 "2021-01-11T19:01:19Z")

</div>

How to stack the boxes with class function,and use array to create 5 boxes

---

## [Let the image object move in different directions](https://discourse.processing.org/t/let-the-image-object-move-in-different-directions/26929)

<div class="topic-metadata">

**Author:** [@Elmpt](https://discourse.processing.org/u/Elmpt)\
**Replies:** 7\
**Last updated:** [January 11, 2021, 2:40pm UTC](https://discourse.processing.org/t/let-the-image-object-move-in-different-directions/26929 "2021-01-11T14:40:37Z")

</div>

Hi everyone! I need some help with understanding, what can I use to make an image object move in the specified direction(vectors maybe…I am not that sure). I have an object that is represented by png image and I want it…

---

## [I have some problems with NPE, and i dont know how to fix it](https://discourse.processing.org/t/i-have-some-problems-with-npe-and-i-dont-know-how-to-fix-it/26968)

<div class="topic-metadata">

**Author:** [@deiwy](https://discourse.processing.org/u/deiwy)\
**Replies:** 1\
**Last updated:** [January 11, 2021, 12:52pm UTC](https://discourse.processing.org/t/i-have-some-problems-with-npe-and-i-dont-know-how-to-fix-it/26968 "2021-01-11T12:52:14Z")

</div>

i try to do a platformer, and i have problems with IntList main code: block\[\] b; button\[\] bu; player p; IntList yB = new IntList(); IntList xB = new IntList(); int menu = 0; void setup(){ for(int i = 0; i \< lev…

---

## [Help exporting PDF](https://discourse.processing.org/t/help-exporting-pdf/26416)

<div class="topic-metadata">

**Author:** [@lucaii](https://discourse.processing.org/u/lucaii)\
**Replies:** 3\
**Last updated:** [January 11, 2021, 10:36am UTC](https://discourse.processing.org/t/help-exporting-pdf/26416 "2021-01-11T10:36:17Z")

</div>

Hi, Around four or five years ago I came up with this code which I now slightly edited. I would like to export a PDF on keypressed but can’t seem to make it work… everytime the pdf exports it’s empty. Any ideas or help …

---

## [Idk where is the error](https://discourse.processing.org/t/idk-where-is-the-error/26952)

<div class="topic-metadata">

**Author:** [@deiwy](https://discourse.processing.org/u/deiwy)\
**Replies:** 2\
**Last updated:** [January 10, 2021, 3:30pm UTC](https://discourse.processing.org/t/idk-where-is-the-error/26952 "2021-01-10T15:30:05Z")

</div>

so, I recently started programming on processing 3, the first game I want to do has to be a platformer, but I made a mistake and I don’t know what it is block\[\] b; int Map\[\]\[\] = { {1,0,0,0,0,0,0,0}, {0,1,0,0,0,1,0,…

---

## [Get new size of PShape after transform (shear)?](https://discourse.processing.org/t/get-new-size-of-pshape-after-transform-shear/18184)

<div class="topic-metadata">

**Author:** [@snaders](https://discourse.processing.org/u/snaders)\
**Replies:** 3\
**Last updated:** [January 10, 2021, 1:57pm UTC](https://discourse.processing.org/t/get-new-size-of-pshape-after-transform-shear/18184 "2021-01-10T13:57:12Z")

</div>

I’m transforming a shape with shearX. I’m looking for a way to get the new ‘real’ size of the shape after transforming. Is this possible? The shape is loaded from a SVG with loadShape. I was thinking to do something lik…

---

## [Creating Random Rectangles Without Overlap](https://discourse.processing.org/t/creating-random-rectangles-without-overlap/26918)

<div class="topic-metadata">

**Author:** [@jSmith](https://discourse.processing.org/u/jSmith)\
**Replies:** 11\
**Last updated:** [January 10, 2021, 12:22pm UTC](https://discourse.processing.org/t/creating-random-rectangles-without-overlap/26918 "2021-01-10T12:22:04Z")

</div>

Hey guys, so I know that there are other posts about this topic but they don’t really seem to help. Other solutions make use of arrayList and class, which I was not taught. And so I was wondering if it is possible to ach…

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

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