# Coding Questions

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

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

**Page:** 55

---

## [I am making a game but i cant figure out how to keep the ellipse inside the window. how do i do this?](https://discourse.processing.org/t/i-am-making-a-game-but-i-cant-figure-out-how-to-keep-the-ellipse-inside-the-window-how-do-i-do-this/29757)

<div class="topic-metadata">

**Author:** [@MoonAlien822](https://discourse.processing.org/u/MoonAlien822)\
**Replies:** 1\
**Last updated:** [April 30, 2021, 8:34pm UTC](https://discourse.processing.org/t/i-am-making-a-game-but-i-cant-figure-out-how-to-keep-the-ellipse-inside-the-window-how-do-i-do-this/29757 "2021-04-30T20:34:41Z")

</div>

float x =0; float y =0; float snelheid\_omlaag = 1; ;void setup() { fullScreen(); } void draw() { ellipse(x, y, 50, 50); x=x+random(-90, 90); y=y+random(-40, 40)+snelheid\_omlaag; i want the keep inside window …

---

## [How do i use a variable to press a key with robot class](https://discourse.processing.org/t/how-do-i-use-a-variable-to-press-a-key-with-robot-class/29752)

<div class="topic-metadata">

**Author:** [@tobich](https://discourse.processing.org/u/tobich)\
**Replies:** 7\
**Last updated:** [April 30, 2021, 7:15pm UTC](https://discourse.processing.org/t/how-do-i-use-a-variable-to-press-a-key-with-robot-class/29752 "2021-04-30T19:15:27Z")

</div>

Basically I’m trying to make a function that will type the key i need Because its a function i give it a string with a variable which is the key i need to press and the robot variable how do i do it?

---

## [MAYDAY MAYDAY / \< ArrayIndexOutOfBoundsException: 3\>](https://discourse.processing.org/t/mayday-mayday-arrayindexoutofboundsexception-3/29702)

<div class="topic-metadata">

**Author:** [@zang](https://discourse.processing.org/u/zang)\
**Replies:** 8\
**Last updated:** [April 30, 2021, 1:35pm UTC](https://discourse.processing.org/t/mayday-mayday-arrayindexoutofboundsexception-3/29702 "2021-04-30T13:35:56Z")

</div>

please format code with \</\> button \* homework policy \* asking questions int amount = 3; PImage img1; int\[\]\[\] state = new int\[amount\]\[amount\]; IntList n; int z; int b =int(sq(amount)-1); int x, y; int tileW = width/amo…

---

## [Random starting Angle to finish Circle](https://discourse.processing.org/t/random-starting-angle-to-finish-circle/29694)

<div class="topic-metadata">

**Author:** [@aldofermaldo](https://discourse.processing.org/u/aldofermaldo)\
**Replies:** 10\
**Last updated:** [April 29, 2021, 11:49am UTC](https://discourse.processing.org/t/random-starting-angle-to-finish-circle/29694 "2021-04-29T11:49:43Z")

</div>

I want to be drawing a circle with beginShape(), starting with a random angle, and to finish a complete circle from that random angle. The problem I’m having is that when I draw from a random starting angle, I don’t kno…

---

## [PGraphics transparency in P3D](https://discourse.processing.org/t/pgraphics-transparency-in-p3d/29703)

<div class="topic-metadata">

**Author:** [@Skranker](https://discourse.processing.org/u/Skranker)\
**Replies:** 3\
**Last updated:** [April 28, 2021, 4:35pm UTC](https://discourse.processing.org/t/pgraphics-transparency-in-p3d/29703 "2021-04-28T16:35:02Z")

</div>

Hey guys, i am trying to draw a pgraphics image on top of the rest of the sketch here. It seems to behave weirdly though. In this example i am drawing a line pattern, at z = -50, an ellipse at 0 and the pgraphics image…

---

## [Need help with creating barriers/walls with boolean](https://discourse.processing.org/t/need-help-with-creating-barriers-walls-with-boolean/29444)

<div class="topic-metadata">

**Author:** [@Cherie](https://discourse.processing.org/u/Cherie)\
**Replies:** 9\
**Last updated:** [April 28, 2021, 8:24am UTC](https://discourse.processing.org/t/need-help-with-creating-barriers-walls-with-boolean/29444 "2021-04-28T08:24:55Z")

</div>

please format code with \</\> button \* homework policy \* asking questions float xpos; float ypos; float xposN; float yposN; float playersize; PVector position; float direction; PVector velocity; float jumpSpeed…

---

## [Variable Problem in Board Game](https://discourse.processing.org/t/variable-problem-in-board-game/29682)

<div class="topic-metadata">

**Author:** [@Braunstein](https://discourse.processing.org/u/Braunstein)\
**Replies:** 3\
**Last updated:** [April 28, 2021, 4:31am UTC](https://discourse.processing.org/t/variable-problem-in-board-game/29682 "2021-04-28T04:31:02Z")

</div>

So, i’m considering turning a (existing) board game into a videogame via Processing. The game is called Machi Koro; if you know it: cool, if you don’t know it: It’s a quick board game where you buy buildings (which are o…

---

## [Need help with other assigned variables](https://discourse.processing.org/t/need-help-with-other-assigned-variables/29569)

<div class="topic-metadata">

**Author:** [@Bakoje](https://discourse.processing.org/u/Bakoje)\
**Replies:** 10\
**Last updated:** [April 27, 2021, 9:21pm UTC](https://discourse.processing.org/t/need-help-with-other-assigned-variables/29569 "2021-04-27T21:21:24Z")

</div>

I really need help with this one. This is how it turned out so far but it would be very nice to add buttons that can align different colored cells according to X,Y,height and width . Also an option to save the grid as a …

---

## [Start again an InDict example](https://discourse.processing.org/t/start-again-an-indict-example/29676)

<div class="topic-metadata">

**Author:** [@yves](https://discourse.processing.org/u/yves)\
**Replies:** 9\
**Last updated:** [April 27, 2021, 8:03pm UTC](https://discourse.processing.org/t/start-again-an-indict-example/29676 "2021-04-27T20:03:56Z")

</div>

Hi every one, I got this InDict example, I would like to restart the all process, when the text is on the bottom of the screen. If you have any idea … Thank’s Yves /\*\* \* CountingString example \* by Daniel Shiffman…

---

## [Figure that returns to its initial position (walkers)](https://discourse.processing.org/t/figure-that-returns-to-its-initial-position-walkers/29670)

<div class="topic-metadata">

**Author:** [@kylu](https://discourse.processing.org/u/kylu)\
**Replies:** 4\
**Last updated:** [April 27, 2021, 7:27pm UTC](https://discourse.processing.org/t/figure-that-returns-to-its-initial-position-walkers/29670 "2021-04-27T19:27:22Z")

</div>

Hi! I have a question, I am working with a walking code and I need the lines that are formed, after a certain time, to progressively return to their initial position. Thanks!

---

## [Variable to store images in a list (ArrayList)](https://discourse.processing.org/t/variable-to-store-images-in-a-list-arraylist/29408)

<div class="topic-metadata">

**Author:** [@Yuls](https://discourse.processing.org/u/Yuls)\
**Replies:** 7\
**Last updated:** [April 27, 2021, 8:52am UTC](https://discourse.processing.org/t/variable-to-store-images-in-a-list-arraylist/29408 "2021-04-27T08:52:25Z")

</div>

Hi everyone, I am new to Processing and to programming in general. So that might be the source of my issue. I’ve been trying to implement and idea into code but I can’t seem to find the proper way to do this. So basical…

---

## [Simon says tinkercad](https://discourse.processing.org/t/simon-says-tinkercad/29651)

<div class="topic-metadata">

**Author:** [@DijaAngel](https://discourse.processing.org/u/DijaAngel)\
**Replies:** 1\
**Last updated:** [April 26, 2021, 12:02pm UTC](https://discourse.processing.org/t/simon-says-tinkercad/29651 "2021-04-26T12:02:21Z")

</div>

\#define SW1 8 #define SW2 11 #define SW3 10 #define SW4 12 #define aSeg 2 #define bSeg 3 #define cSeg 4 #define dSeg 5 #define eSeg 6 #define fSeg 7 #define gSeg 13 #define NOTE\_A4 440 #define NOTE\_B4 440 #define NOTE\_…

---

## [Auto tile background image as mouse goes beyond boundaries](https://discourse.processing.org/t/auto-tile-background-image-as-mouse-goes-beyond-boundaries/29639)

<div class="topic-metadata">

**Author:** [@deanomite](https://discourse.processing.org/u/deanomite)\
**Replies:** 2\
**Last updated:** [April 25, 2021, 8:24pm UTC](https://discourse.processing.org/t/auto-tile-background-image-as-mouse-goes-beyond-boundaries/29639 "2021-04-25T20:24:38Z")

</div>

Hi there, I would like to get an image loaded in background to get tiled automatically as the mouse moves out of bounds. So if my mouse moved upwards i.e. height\<0, the image would automatically repeat itself giving the…

---

## [Visual Border in Top-Down-2D-Game is weirdly misplaced](https://discourse.processing.org/t/visual-border-in-top-down-2d-game-is-weirdly-misplaced/29632)

<div class="topic-metadata">

**Author:** [@Braunstein](https://discourse.processing.org/u/Braunstein)\
**Replies:** 3\
**Last updated:** [April 25, 2021, 8:04pm UTC](https://discourse.processing.org/t/visual-border-in-top-down-2d-game-is-weirdly-misplaced/29632 "2021-04-25T20:04:43Z")

</div>

I’m making a 2D survival game, with a top-down perspective. I don’t want the world to be infinite, so i made the map a square, with the sides being 200.000 pixels long. The script for moving the player works fine (so the…

---

## [Keep getting noClassDefFoundError Errors on Mac](https://discourse.processing.org/t/keep-getting-noclassdeffounderror-errors-on-mac/11727)

<div class="topic-metadata">

**Author:** [@Bat754](https://discourse.processing.org/u/Bat754)\
**Replies:** 3\
**Last updated:** [April 25, 2021, 12:25pm UTC](https://discourse.processing.org/t/keep-getting-noclassdeffounderror-errors-on-mac/11727 "2021-04-25T12:25:10Z")

</div>

Got a quick little question. This past week, I’ve been working on some Java projects on my windows PC at home using Processing for the graphics. I’ve been using the ItelliJ IDE to add the processing library to the proje…

---

## [Comment faire une rotation d'image dans un tableau](https://discourse.processing.org/t/comment-faire-une-rotation-dimage-dans-un-tableau/29551)

<div class="topic-metadata">

**Author:** [@Macarongirl](https://discourse.processing.org/u/Macarongirl)\
**Replies:** 4\
**Last updated:** [April 24, 2021, 10:07pm UTC](https://discourse.processing.org/t/comment-faire-une-rotation-dimage-dans-un-tableau/29551 "2021-04-24T22:07:48Z")

</div>

Bonjour, Je suis une étudiante en design et pour un projet je souhaitais réaliser un jardin numérique. Je débute dans le milieu de processing et la base du code est faite en collaboration avec mon professeur de techno.…

---

## [Cycling through days of the week](https://discourse.processing.org/t/cycling-through-days-of-the-week/29609)

<div class="topic-metadata">

**Author:** [@Th3cG](https://discourse.processing.org/u/Th3cG)\
**Replies:** 2\
**Last updated:** [April 24, 2021, 9:29pm UTC](https://discourse.processing.org/t/cycling-through-days-of-the-week/29609 "2021-04-24T21:29:58Z")

</div>

Hi. I’m trying to write a code that cycles through the days of the week. Specifically, if today is Saturday, my code has to print today is Saturday tomorrow is Sunday the day after tomorrow is Monday and this has to…

---

## [About a project of processing .. I need a help](https://discourse.processing.org/t/about-a-project-of-processing-i-need-a-help/28865)

<div class="topic-metadata">

**Author:** [@Tassadit](https://discourse.processing.org/u/Tassadit)\
**Replies:** 20\
**Last updated:** [April 24, 2021, 6:04pm UTC](https://discourse.processing.org/t/about-a-project-of-processing-i-need-a-help/28865 "2021-04-24T18:04:39Z")

</div>

Please i need a help in my project . i hope that you help me to have the correct code. Nombres rationnels Sur le modèle des nombres complexes, on se propose de réaliser une classe qui représente les nombres rationnels. …

---

## [Parallel&horizontal lines using loops](https://discourse.processing.org/t/parallel-horizontal-lines-using-loops/29591)

<div class="topic-metadata">

**Author:** [@lelapin](https://discourse.processing.org/u/lelapin)\
**Replies:** 3\
**Last updated:** [April 24, 2021, 5:07pm UTC](https://discourse.processing.org/t/parallel-horizontal-lines-using-loops/29591 "2021-04-24T17:07:01Z")

</div>

Hello please i need help in my homework: Exercise: draw random parallel and horizontal lines using loops.The length of each line is a random number between 0 and 44. Thanks

---

## [My program isn't doing what I want it to do (x and o game / Tic Tac Toe)](https://discourse.processing.org/t/my-program-isnt-doing-what-i-want-it-to-do-x-and-o-game-tic-tac-toe/25516)

<div class="topic-metadata">

**Author:** [@DijaAngel](https://discourse.processing.org/u/DijaAngel)\
**Replies:** 68\
**Last updated:** [April 24, 2021, 3:19pm UTC](https://discourse.processing.org/t/my-program-isnt-doing-what-i-want-it-to-do-x-and-o-game-tic-tac-toe/25516 "2021-04-24T15:19:44Z")

</div>

char player=‘X’; void setup(){ size(600,600); background(255); strokeWeight(6); noFill(); } void draw(){ stroke(0); line(200,100,200,500); line(400,100,400,500); } void mouseClicked(){ if(player==‘X’){ stro…

---

## [Interactive shape masking with PGraphics](https://discourse.processing.org/t/interactive-shape-masking-with-pgraphics/29601)

<div class="topic-metadata">

**Author:** [@PatJOAO](https://discourse.processing.org/u/PatJOAO)\
**Replies:** 1\
**Last updated:** [April 24, 2021, 12:32pm UTC](https://discourse.processing.org/t/interactive-shape-masking-with-pgraphics/29601 "2021-04-24T12:32:10Z")

</div>

Hi there! Building up on a great post from the old forum: https://forum.processing.org/two/discussion/comment/77997/#Comment\_77997 shape. masking with PGraphics — was wondering if some one can give me a tip to how to a…

---

## [How to force a path to write a file outside of the sketch directory?](https://discourse.processing.org/t/how-to-force-a-path-to-write-a-file-outside-of-the-sketch-directory/29579)

<div class="topic-metadata">

**Author:** [@Liu.Exit](https://discourse.processing.org/u/Liu.Exit)\
**Replies:** 3\
**Last updated:** [April 24, 2021, 8:41am UTC](https://discourse.processing.org/t/how-to-force-a-path-to-write-a-file-outside-of-the-sketch-directory/29579 "2021-04-24T08:41:02Z")

</div>

SelectFolder is not suitable for me because it opens a window … Thanks.

---

## [Finding nearest neighbor points](https://discourse.processing.org/t/finding-nearest-neighbor-points/29593)

<div class="topic-metadata">

**Author:** [@Mort](https://discourse.processing.org/u/Mort)\
**Replies:** 1\
**Last updated:** [April 24, 2021, 3:36am UTC](https://discourse.processing.org/t/finding-nearest-neighbor-points/29593 "2021-04-24T03:36:36Z")

</div>

Hi, I am having trouble with finding the nearest neighbor points. I am trying to create a web of lines connecting randomly generated points to each other. these lines are supposed to connect the nearest points to each ot…

---

## [Removing current X values from a possible arrayList object spawn](https://discourse.processing.org/t/removing-current-x-values-from-a-possible-arraylist-object-spawn/29560)

<div class="topic-metadata">

**Author:** [@spamelim](https://discourse.processing.org/u/spamelim)\
**Replies:** 3\
**Last updated:** [April 23, 2021, 9:52pm UTC](https://discourse.processing.org/t/removing-current-x-values-from-a-possible-arraylist-object-spawn/29560 "2021-04-23T21:52:47Z")

</div>

Hello, I am working on a game where a ship avoids walls in 3D. I wanted to make sure the walls do not overlap in x values. Currently, they spawn in on a timed interval like so: if (walls.size() \<= max) { // max is a…

---

## [Bezier & ellipse](https://discourse.processing.org/t/bezier-ellipse/29572)

<div class="topic-metadata">

**Author:** [@kylu](https://discourse.processing.org/u/kylu)\
**Replies:** 3\
**Last updated:** [April 23, 2021, 8:37pm UTC](https://discourse.processing.org/t/bezier-ellipse/29572 "2021-04-23T20:37:41Z")

</div>

Hey! i need some help, i’m working in a code, and i have a question, can i uso bezier in a ellipse? I need the shape of the ellipse to change as I go through it. Depending on the position of the mouse, the bezier posit…

---

## [Making a class move](https://discourse.processing.org/t/making-a-class-move/29571)

<div class="topic-metadata">

**Author:** [@chatters22](https://discourse.processing.org/u/chatters22)\
**Replies:** 8\
**Last updated:** [April 23, 2021, 11:14am UTC](https://discourse.processing.org/t/making-a-class-move/29571 "2021-04-23T11:14:38Z")

</div>

I’m quite new to Processing, earlier when I wasn’t working with classes I could easily make my objects move with simple code like xLoc = xLoc + 1. But now I’m working with classes, and I can’t get them to move for some r…

---

## [Computing a moving average](https://discourse.processing.org/t/computing-a-moving-average/28996)

<div class="topic-metadata">

**Author:** [@bking](https://discourse.processing.org/u/bking)\
**Replies:** 18\
**Last updated:** [April 22, 2021, 6:21pm UTC](https://discourse.processing.org/t/computing-a-moving-average/28996 "2021-04-22T18:21:01Z")

</div>

Hi there, I often and manually change the values of a data. In order to make the transitions less abrupt, I would like to have for a short time the average between the last value and the value just before. If I choose …

---

## [Problems with creating soft body in processing](https://discourse.processing.org/t/problems-with-creating-soft-body-in-processing/29535)

<div class="topic-metadata">

**Author:** [@Rafsing](https://discourse.processing.org/u/Rafsing)\
**Replies:** 1\
**Last updated:** [April 21, 2021, 10:09am UTC](https://discourse.processing.org/t/problems-with-creating-soft-body-in-processing/29535 "2021-04-21T10:09:05Z")

</div>

I am having trouble forming a soft body where each side is a spring. When they are created, they do not merge into one object, but create as many springs as there are vertices in the figure. This code is responsible for …

---

## [Question with duplication words](https://discourse.processing.org/t/question-with-duplication-words/29511)

<div class="topic-metadata">

**Author:** [@Pokeyace](https://discourse.processing.org/u/Pokeyace)\
**Replies:** 6\
**Last updated:** [April 21, 2021, 4:48am UTC](https://discourse.processing.org/t/question-with-duplication-words/29511 "2021-04-21T04:48:34Z")

</div>

String S; int L, i, j; String W\[\]; boolean build; void setup(){ // Initializations S = “We are the world We are the children”; L = S.length(); j = 0; W = new String\[100\]; W\[0\] = “”; // Main loop for(i = 0; i \<…

---

## [Creating and deleting files](https://discourse.processing.org/t/creating-and-deleting-files/29466)

<div class="topic-metadata">

**Author:** [@Th3cG](https://discourse.processing.org/u/Th3cG)\
**Replies:** 12\
**Last updated:** [April 20, 2021, 6:42pm UTC](https://discourse.processing.org/t/creating-and-deleting-files/29466 "2021-04-20T18:42:32Z")

</div>

I’m trying to make a little app for personal use intended to get weather data from a website. To make this, I have to make some workaround to bypass a 403 error and I’m able to create three files (one for every day for w…

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

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