# Coding Questions

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

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

**Page:** 136

---

## [Applying collisions and physics to a processing 3 project](https://discourse.processing.org/t/applying-collisions-and-physics-to-a-processing-3-project/12049)

<div class="topic-metadata">

**Author:** [@Bluu](https://discourse.processing.org/u/Bluu)\
**Replies:** 0\
**Last updated:** [June 14, 2019, 12:21am UTC](https://discourse.processing.org/t/applying-collisions-and-physics-to-a-processing-3-project/12049 "2019-06-14T00:21:46Z")

</div>

I’ve been working on a simulation project which has a cannon and 2 towers of blocks which must collide with each other in a way that causes movement(however rotation is not required, just displacement and gravity) I’ve …

---

## [Border for a picture](https://discourse.processing.org/t/border-for-a-picture/11812)

<div class="topic-metadata">

**Author:** [@Dominik\_rgn](https://discourse.processing.org/u/Dominik_rgn)\
**Replies:** 15\
**Last updated:** [June 13, 2019, 10:27am UTC](https://discourse.processing.org/t/border-for-a-picture/11812 "2019-06-13T10:27:24Z")

</div>

I would like to have a border for the picture Can anybody help me with this? PImage bg; float xo; float yo; float zoom = 1.7; void setup () { size(800, 600); smooth(); noStroke(); bg = loadImage("bg.jpg"); } …

---

## [Simplify box selection in a table](https://discourse.processing.org/t/simplify-box-selection-in-a-table/12026)

<div class="topic-metadata">

**Author:** [@hugo](https://discourse.processing.org/u/hugo)\
**Replies:** 4\
**Last updated:** [June 13, 2019, 5:40am UTC](https://discourse.processing.org/t/simplify-box-selection-in-a-table/12026 "2019-06-13T05:40:58Z")

</div>

hello, here is my program : int AM=0; int R=0; void setup() { frameRate(30); size(480,320); } void draw() { background(255); stroke(180); strokeWeight(2); for (int ix = 64; ix \< 315; ix = ix+64) { lin…

---

## [Why aren't my ellipses spawning in the proper location?](https://discourse.processing.org/t/why-arent-my-ellipses-spawning-in-the-proper-location/11972)

<div class="topic-metadata">

**Author:** [@newone](https://discourse.processing.org/u/newone)\
**Replies:** 1\
**Last updated:** [June 12, 2019, 6:46pm UTC](https://discourse.processing.org/t/why-arent-my-ellipses-spawning-in-the-proper-location/11972 "2019-06-12T18:46:00Z")

</div>

Hello Processing forum users, I am currently having an issue with my Tank simulation program: there are a few tanks roaming around on my screen and they shoot bullets(ellipses) at each other. The fire() method adds a bu…

---

## [Geomerative: Smooth Font Rendering](https://discourse.processing.org/t/geomerative-smooth-font-rendering/11978)

<div class="topic-metadata">

**Author:** [@heyarne](https://discourse.processing.org/u/heyarne)\
**Replies:** 1\
**Last updated:** [June 12, 2019, 5:40pm UTC](https://discourse.processing.org/t/geomerative-smooth-font-rendering/11978 "2019-06-12T17:40:50Z")

</div>

Hi! I started playing around with the Geomerative library and I like it a lot. I intended to play around with different fonts and noticed that when polygonizing the outlines, the resulting shape looks a bit jagged. Here’…

---

## [URGENT! Need help for test tomorrow!](https://discourse.processing.org/t/urgent-need-help-for-test-tomorrow/12004)

<div class="topic-metadata">

**Author:** [@KZ0202](https://discourse.processing.org/u/KZ0202)\
**Replies:** 1\
**Last updated:** [June 12, 2019, 4:27am UTC](https://discourse.processing.org/t/urgent-need-help-for-test-tomorrow/12004 "2019-06-12T04:27:58Z")

</div>

I have a test tomorrow and I don’t know what is wrong with my code. I am supposed to make one ellipse and a rectangle with a circle following the mouse. The circle is on top of the ellipse but behind the rectangle. How d…

---

## [Loading data into the processing](https://discourse.processing.org/t/loading-data-into-the-processing/11949)

<div class="topic-metadata">

**Author:** [@BallazX](https://discourse.processing.org/u/BallazX)\
**Replies:** 2\
**Last updated:** [June 11, 2019, 3:29pm UTC](https://discourse.processing.org/t/loading-data-into-the-processing/11949 "2019-06-11T15:29:40Z")

</div>

Hey, Im trying to load some data from a csv file. The data tab contains this code: Table data=loadTable("values.csv"); TableRow row=data.getRow(0); float x1=row.getInt(0); float y1=row.getInt(1); float x2=row.getInt…

---

## [How can I put a three second delay within an if loop?](https://discourse.processing.org/t/how-can-i-put-a-three-second-delay-within-an-if-loop/11965)

<div class="topic-metadata">

**Author:** [@Gaspaider](https://discourse.processing.org/u/Gaspaider)\
**Replies:** 4\
**Last updated:** [June 10, 2019, 8:59pm UTC](https://discourse.processing.org/t/how-can-i-put-a-three-second-delay-within-an-if-loop/11965 "2019-06-10T20:59:29Z")

</div>

Hey there! I know there have been questions very similar to this using millis() before but I can’t find a way to build those answers into my program. Timer is a variable for something else. I would like to add a three se…

---

## [On window resize, variable current value evaporates](https://discourse.processing.org/t/on-window-resize-variable-current-value-evaporates/11952)

<div class="topic-metadata">

**Author:** [@edward](https://discourse.processing.org/u/edward)\
**Replies:** 7\
**Last updated:** [June 10, 2019, 6:44pm UTC](https://discourse.processing.org/t/on-window-resize-variable-current-value-evaporates/11952 "2019-06-10T18:44:45Z")

</div>

My project will involve multiple text input boxes which must move and adjust position dynamically when I resize the window. This bare-to-basics code only includes two boxes, when the mouse is over a box, the box is high…

---

## [How to get a shape to change color when mouse is over it?](https://discourse.processing.org/t/how-to-get-a-shape-to-change-color-when-mouse-is-over-it/11974)

<div class="topic-metadata">

**Author:** [@benfitzy21](https://discourse.processing.org/u/benfitzy21)\
**Replies:** 1\
**Last updated:** [June 10, 2019, 4:39pm UTC](https://discourse.processing.org/t/how-to-get-a-shape-to-change-color-when-mouse-is-over-it/11974 "2019-06-10T16:39:33Z")

</div>

Can someone help, I have been sitting here trying to figure this out for 3 hours.

---

## [Help with user input dialogues](https://discourse.processing.org/t/help-with-user-input-dialogues/11955)

<div class="topic-metadata">

**Author:** [@rory](https://discourse.processing.org/u/rory)\
**Replies:** 1\
**Last updated:** [June 10, 2019, 3:29am UTC](https://discourse.processing.org/t/help-with-user-input-dialogues/11955 "2019-06-10T03:29:16Z")

</div>

Hello again, I’m making a “Geometry tutor” program which contains instructions, learn, and a practice section where the user can quiz themselves. I have been instructed to use a specific input file for the quiz question…

---

## [Modifing functions in classes using extends](https://discourse.processing.org/t/modifing-functions-in-classes-using-extends/11913)

<div class="topic-metadata">

**Author:** [@skyjoe66](https://discourse.processing.org/u/skyjoe66)\
**Replies:** 2\
**Last updated:** [June 9, 2019, 11:05pm UTC](https://discourse.processing.org/t/modifing-functions-in-classes-using-extends/11913 "2019-06-09T23:05:27Z")

</div>

i am making a game and am using nested classes to create block variations, but i want tree to have an addition to the drawing process (a progress bar). is there a way to use the same function call but have it run like no…

---

## [\[SOLVED\] Creating "FPS-like" mouse detection](https://discourse.processing.org/t/solved-creating-fps-like-mouse-detection/11946)

<div class="topic-metadata">

**Author:** [@koorkevani](https://discourse.processing.org/u/koorkevani)\
**Replies:** 3\
**Last updated:** [June 9, 2019, 10:57pm UTC](https://discourse.processing.org/t/solved-creating-fps-like-mouse-detection/11946 "2019-06-09T22:57:09Z")

</div>

I’m trying to recreate the controls of the game Minecraft. For those who don’t know, when you move the mouse, the direction you’re facing changes accordingly (if you’re moving the mouse upwards, it’s like looking upwards…

---

## [Line first coordinate is allways (0,0)](https://discourse.processing.org/t/line-first-coordinate-is-allways-0-0/11942)

<div class="topic-metadata">

**Author:** [@BallazX](https://discourse.processing.org/u/BallazX)\
**Replies:** 2\
**Last updated:** [June 9, 2019, 2:34pm UTC](https://discourse.processing.org/t/line-first-coordinate-is-allways-0-0/11942 "2019-06-09T14:34:37Z")

</div>

Hey All, I would like to draw some lines: void setup() { size(600, 600); noLoop(); } void draw(){ line(pmouseX, pmouseY, mouseX, mouseY); } void mouseClicked() { redraw(); } My problem is, that the first line …

---

## [Save data to "secure" or hidden file](https://discourse.processing.org/t/save-data-to-secure-or-hidden-file/11868)

<div class="topic-metadata">

**Author:** [@mala](https://discourse.processing.org/u/mala)\
**Replies:** 4\
**Last updated:** [June 9, 2019, 10:27am UTC](https://discourse.processing.org/t/save-data-to-secure-or-hidden-file/11868 "2019-06-09T10:27:30Z")

</div>

I have various auto saved & auto loaded settings in my app that I don’t want an end user messing with, what is the best way from preventing them doing this ? Is there a way to export data (a Table for example) to a form…

---

## [Add PGraphics to a custom method](https://discourse.processing.org/t/add-pgraphics-to-a-custom-method/11930)

<div class="topic-metadata">

**Author:** [@BallazX](https://discourse.processing.org/u/BallazX)\
**Replies:** 3\
**Last updated:** [June 8, 2019, 8:34pm UTC](https://discourse.processing.org/t/add-pgraphics-to-a-custom-method/11930 "2019-06-08T20:34:07Z")

</div>

Hi All, I’ve got this code: void myrect(float xa,float ya,float xb,float yb){ float x1=xa; if(xa\>xb) { while(xb\<x1){ x1--; point(x1,ya); point(x1,yb); } } else if(x1\<xb){ while(x1\<xb…

---

## [Clear() not working properly](https://discourse.processing.org/t/clear-not-working-properly/11924)

<div class="topic-metadata">

**Author:** [@BallazX](https://discourse.processing.org/u/BallazX)\
**Replies:** 1\
**Last updated:** [June 8, 2019, 3:25pm UTC](https://discourse.processing.org/t/clear-not-working-properly/11924 "2019-06-08T15:25:04Z")

</div>

Hi All, I’ve got this code: PGraphics myline; PGraphics myrect; void setup(){ background(#FFFFFF); size(600,600); myline=createGraphics(width,height); myrect=createGraphics(width,height); } void draw(){ myrect.beginD…

---

## [blendMode in 3d space](https://discourse.processing.org/t/blendmode-in-3d-space/11857)

<div class="topic-metadata">

**Author:** [@bitCrasher](https://discourse.processing.org/u/bitCrasher)\
**Replies:** 1\
**Last updated:** [June 7, 2019, 9:31pm UTC](https://discourse.processing.org/t/blendmode-in-3d-space/11857 "2019-06-07T21:31:11Z")

</div>

hello guys! i’ve a problem…i’m try to blend with mode ADD some png images in a 3d space, the problem is that it create artifacts, and transparency of background is removed class Particle { PVector pos; PImage img; …

---

## [Map function to a radian value](https://discourse.processing.org/t/map-function-to-a-radian-value/11903)

<div class="topic-metadata">

**Author:** [@GuilhermeVolker](https://discourse.processing.org/u/GuilhermeVolker)\
**Replies:** 3\
**Last updated:** [June 7, 2019, 8:49pm UTC](https://discourse.processing.org/t/map-function-to-a-radian-value/11903 "2019-06-07T20:49:32Z")

</div>

Hello! I need to move an image, from the lateral mouse input to a specific angle on the screen (from 240º to 300º). The direct transformation (as the code) doesn’t work. Is there another way to do that? (to simplify the…

---

## [PGraphics and main window, nice code possible?](https://discourse.processing.org/t/pgraphics-and-main-window-nice-code-possible/11898)

<div class="topic-metadata">

**Author:** [@toby](https://discourse.processing.org/u/toby)\
**Replies:** 4\
**Last updated:** [June 7, 2019, 5:22pm UTC](https://discourse.processing.org/t/pgraphics-and-main-window-nice-code-possible/11898 "2019-06-07T17:22:59Z")

</div>

Hello Processing friends. I wonder if anyone could help please. I have a sketch that renders stuff in a small main window, and when ready renders it at hi-res to a PGraphics which is then saved to a file. My code is ugly…

---

## [Change in color scheme](https://discourse.processing.org/t/change-in-color-scheme/11895)

<div class="topic-metadata">

**Author:** [@beatrizt](https://discourse.processing.org/u/beatrizt)\
**Replies:** 11\
**Last updated:** [June 7, 2019, 2:14pm UTC](https://discourse.processing.org/t/change-in-color-scheme/11895 "2019-06-07T14:14:02Z")

</div>

Hello, can somebody please tell me what I am doing wrong?? Basically what I want is when the mouse is over the area of the square, I want the colors of both the squares and the ellipses to shift. At first, the squares …

---

## [Rollover with animation](https://discourse.processing.org/t/rollover-with-animation/11890)

<div class="topic-metadata">

**Author:** [@beatrizt](https://discourse.processing.org/u/beatrizt)\
**Replies:** 7\
**Last updated:** [June 7, 2019, 2:04pm UTC](https://discourse.processing.org/t/rollover-with-animation/11890 "2019-06-07T14:04:31Z")

</div>

Hey, can someone please tell me what I am doing wrong here: int radius=0; int length= 720; float colorscheme1; float colorscheme2; float mouseX; float mouseY; boolean rectIsShrinking = true; boolean circleIsShrin…

---

## [Orthographic path traveling](https://discourse.processing.org/t/orthographic-path-traveling/11786)

<div class="topic-metadata">

**Author:** [@8BitRift](https://discourse.processing.org/u/8BitRift)\
**Replies:** 2\
**Last updated:** [June 6, 2019, 9:26pm UTC](https://discourse.processing.org/t/orthographic-path-traveling/11786 "2019-06-06T21:26:15Z")

</div>

So I am trying to use the camera function and the orthographic view to travel down a path I have managed to get it to work with perspective but I cant get it to work properly with the orthographic view. Below is the code…

---

## [More and Faster: glInterleavedArrays glDrawArrays](https://discourse.processing.org/t/more-and-faster-glinterleavedarrays-gldrawarrays/5044)

<div class="topic-metadata">

**Author:** [@TPMoyer](https://discourse.processing.org/u/TPMoyer)\
**Replies:** 5\
**Last updated:** [June 6, 2019, 1:33pm UTC](https://discourse.processing.org/t/more-and-faster-glinterleavedarrays-gldrawarrays/5044 "2019-06-06T13:33:35Z")

</div>

Anyone have pointers as to how I might move toward being able to use the array functions from openGL (glInterleavedArrays and glDrawArrays) within processing? Am ok if this involves my needing to develop a library. …

---

## [Buttons with same coordinates are clicked twice](https://discourse.processing.org/t/buttons-with-same-coordinates-are-clicked-twice/11877)

<div class="topic-metadata">

**Author:** [@rory](https://discourse.processing.org/u/rory)\
**Replies:** 4\
**Last updated:** [June 6, 2019, 11:54am UTC](https://discourse.processing.org/t/buttons-with-same-coordinates-are-clicked-twice/11877 "2019-06-06T11:54:08Z")

</div>

A beginner’s question with buttons. I’m trying to make a program which contains different pages such as splashscreen, main menu, etc. The first page splashScreen() asks the user click anywhere to continue, and then goes …

---

## [How to do a animated colored Keyboard?](https://discourse.processing.org/t/how-to-do-a-animated-colored-keyboard/11763)

<div class="topic-metadata">

**Author:** [@Moiizez](https://discourse.processing.org/u/Moiizez)\
**Replies:** 12\
**Last updated:** [June 6, 2019, 9:52am UTC](https://discourse.processing.org/t/how-to-do-a-animated-colored-keyboard/11763 "2019-06-06T09:52:34Z")

</div>

Hey, I need some help with this thing I’m trying to do. I wanna create a keyboard in Processing, that when you press a key, it selects a random color and a cub “grow up” on the screen (in the place that the rect is plac…

---

## [Reading data from .TXT file](https://discourse.processing.org/t/reading-data-from-txt-file/11695)

<div class="topic-metadata">

**Author:** [@GuilhermeVolker](https://discourse.processing.org/u/GuilhermeVolker)\
**Replies:** 10\
**Last updated:** [May 30, 2019, 6:20am UTC](https://discourse.processing.org/t/reading-data-from-txt-file/11695 "2019-05-30T06:20:36Z")

</div>

I’am having trouble to read data from a file and store on variables. I already tryed several diferents approachs but none of them were sucssesful. The problem i’am having with this code is that i’am only reaciving data …

---

## [Help with X coordinate that will switch back and forth?](https://discourse.processing.org/t/help-with-x-coordinate-that-will-switch-back-and-forth/11843)

<div class="topic-metadata">

**Author:** [@Pbchocochipcheerios](https://discourse.processing.org/u/Pbchocochipcheerios)\
**Replies:** 2\
**Last updated:** [June 6, 2019, 5:55am UTC](https://discourse.processing.org/t/help-with-x-coordinate-that-will-switch-back-and-forth/11843 "2019-06-06T05:55:51Z")

</div>

I want to animate a triangle by changing the x2 point to match x1 so that it becomes a line. I want it to look like it is a triangle switching from triangle to line, triangle to line, etc. Does anyone know how I can do t…

---

## [Polygon filling algorithm example (scanline)](https://discourse.processing.org/t/polygon-filling-algorithm-example-scanline/11778)

<div class="topic-metadata">

**Author:** [@BProcess](https://discourse.processing.org/u/BProcess)\
**Replies:** 4\
**Last updated:** [June 6, 2019, 5:44am UTC](https://discourse.processing.org/t/polygon-filling-algorithm-example-scanline/11778 "2019-06-06T05:44:07Z")

</div>

Hi All, I would like to do the sacn line algorithm in Processing. I have read a lot about it but I have no clue how to start it. Do you have any example or something what helps to start to implement it? Thanks a lot in…

---

## [Static and moving objects](https://discourse.processing.org/t/static-and-moving-objects/11809)

<div class="topic-metadata">

**Author:** [@BallazX](https://discourse.processing.org/u/BallazX)\
**Replies:** 2\
**Last updated:** [June 6, 2019, 2:28am UTC](https://discourse.processing.org/t/static-and-moving-objects/11809 "2019-06-06T02:28:12Z")

</div>

Hello Guys, I’m trying to do the following: I’m drawing some circle by clicking with the mouse I have a rect with a given coordinates I’d like to move the rect with the keyboard Every time I’m moving the rect the old…

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

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