# Coding Questions

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

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

**Page:** 156

---

## [How to ADD or Subtract two values from key board and show result in same window?](https://discourse.processing.org/t/how-to-add-or-subtract-two-values-from-key-board-and-show-result-in-same-window/7302)

<div class="topic-metadata">

**Author:** [@Towhid](https://discourse.processing.org/u/Towhid)\
**Replies:** 8\
**Last updated:** [January 11, 2019, 12:49pm UTC](https://discourse.processing.org/t/how-to-add-or-subtract-two-values-from-key-board-and-show-result-in-same-window/7302 "2019-01-11T12:49:43Z")

</div>

Hi, Here I attach screenshot of my processing project. Here I subtract 2 values by putting in my code. but i want to take those values from keyboard after run the program and showing results in that place. MY CODE …

---

## [Sutcliffe Pentagons](https://discourse.processing.org/t/sutcliffe-pentagons/7262)

<div class="topic-metadata">

**Author:** [@Suzie](https://discourse.processing.org/u/Suzie)\
**Replies:** 5\
**Last updated:** [January 11, 2019, 8:12am UTC](https://discourse.processing.org/t/sutcliffe-pentagons/7262 "2019-01-11T08:12:19Z")

</div>

Hi, I am trying to draw a Sutcliffe Pentagons and just get started with processing. I want to start with drawing a recursive pentagon which is in the middle of the Sutcliffe Pentagons but my code only draw one for me. D…

---

## [\[SOLVED\] How do you make a SS Function?](https://discourse.processing.org/t/solved-how-do-you-make-a-ss-function/7406)

<div class="topic-metadata">

**Author:** [@Typhoon](https://discourse.processing.org/u/Typhoon)\
**Replies:** 2\
**Last updated:** [January 11, 2019, 4:14am UTC](https://discourse.processing.org/t/solved-how-do-you-make-a-ss-function/7406 "2019-01-11T04:14:29Z")

</div>

How do you go ahead and make side scrolling in processing?

---

## [Proccessing Game Over funktion](https://discourse.processing.org/t/proccessing-game-over-funktion/7403)

<div class="topic-metadata">

**Author:** [@TheSkyCrafter](https://discourse.processing.org/u/TheSkyCrafter)\
**Replies:** 3\
**Last updated:** [January 11, 2019, 3:22am UTC](https://discourse.processing.org/t/proccessing-game-over-funktion/7403 "2019-01-11T03:22:41Z")

</div>

Hello, I have created a little game in progress. You can move the character in the X position and fall down from above. You have a random X position and a random speed. If you run into an obstacle, I want the Gamestate v…

---

## [\[SOLVED\] Question about flipping Images](https://discourse.processing.org/t/solved-question-about-flipping-images/7391)

<div class="topic-metadata">

**Author:** [@Typhoon](https://discourse.processing.org/u/Typhoon)\
**Replies:** 7\
**Last updated:** [January 10, 2019, 10:15pm UTC](https://discourse.processing.org/t/solved-question-about-flipping-images/7391 "2019-01-10T22:15:39Z")

</div>

How do you go ahead and flip an array of images in processing? Im trying to make a game where the character runs left and right but i only have the pictures for him to run right,

---

## [Two PVector variables update but only one is changed](https://discourse.processing.org/t/two-pvector-variables-update-but-only-one-is-changed/7388)

<div class="topic-metadata">

**Author:** [@delsey](https://discourse.processing.org/u/delsey)\
**Replies:** 5\
**Last updated:** [January 10, 2019, 3:24pm UTC](https://discourse.processing.org/t/two-pvector-variables-update-but-only-one-is-changed/7388 "2019-01-10T15:24:05Z")

</div>

PVector p; PVector newP; void setup() { p = new PVector(500, 300); newP = new PVector(500, 300); } void draw() { newP = p; println(newP + " \< newP before"); // Adds to p p.add(50, 100); println(newP + "…

---

## [Getting PShape primitive sizes](https://discourse.processing.org/t/getting-pshape-primitive-sizes/7375)

<div class="topic-metadata">

**Author:** [@Aleksi](https://discourse.processing.org/u/Aleksi)\
**Replies:** 1\
**Last updated:** [January 10, 2019, 2:41am UTC](https://discourse.processing.org/t/getting-pshape-primitive-sizes/7375 "2019-01-10T02:41:29Z")

</div>

Is there a way to obtain the size of a PShape primitive? PShape ps1 = createShape(); ps1.beginShape(); ps1.vertex(-50, -50); ps1.vertex(50, -50); ps1.vertex(50, 50); ps1.vertex(-50, 50); ps1.endShape(CLOSE); println(ps1…

---

## [I'm trying to use arrarys to make circles fall](https://discourse.processing.org/t/im-trying-to-use-arrarys-to-make-circles-fall/7371)

<div class="topic-metadata">

**Author:** [@squirrel1969](https://discourse.processing.org/u/squirrel1969)\
**Replies:** 5\
**Last updated:** [January 9, 2019, 9:53pm UTC](https://discourse.processing.org/t/im-trying-to-use-arrarys-to-make-circles-fall/7371 "2019-01-09T21:53:51Z")

</div>

Hello! I’m new to processing and coding in general and for our final project I want to make a game where circles move across the screen horizontally and you have to avoid them. We didn’t learn how to use arrays, but I w…

---

## [I wanted to make a object move to a target when mouse is clicked how would i do this](https://discourse.processing.org/t/i-wanted-to-make-a-object-move-to-a-target-when-mouse-is-clicked-how-would-i-do-this/7365)

<div class="topic-metadata">

**Author:** [@redFoa](https://discourse.processing.org/u/redFoa)\
**Replies:** 1\
**Last updated:** [January 9, 2019, 6:20pm UTC](https://discourse.processing.org/t/i-wanted-to-make-a-object-move-to-a-target-when-mouse-is-clicked-how-would-i-do-this/7365 "2019-01-09T18:20:07Z")

</div>

void setup(){ size(500,500); } void draw(){ fill(0); rect(100, 200, 40, 40); fill(255,0,5); rect(400, 400, 40, 40); }

---

## [So I need some help lol EDIT: Answered!](https://discourse.processing.org/t/so-i-need-some-help-lol-edit-answered/7361)

<div class="topic-metadata">

**Author:** [@Typhoon](https://discourse.processing.org/u/Typhoon)\
**Replies:** 2\
**Last updated:** [January 9, 2019, 5:16pm UTC](https://discourse.processing.org/t/so-i-need-some-help-lol-edit-answered/7361 "2019-01-09T17:16:04Z")

</div>

Hey, So Im trying to make my animation only run through once, it is repeating. Im trying to make it only go through once and be done. (Im making a castlevaniaesk game) (Its also for my grade 12 final project) class Alu…

---

## [Pimage array: How to avoid OutOfBoundsException](https://discourse.processing.org/t/pimage-array-how-to-avoid-outofboundsexception/7356)

<div class="topic-metadata">

**Author:** [@amaia](https://discourse.processing.org/u/amaia)\
**Replies:** 3\
**Last updated:** [January 9, 2019, 3:35pm UTC](https://discourse.processing.org/t/pimage-array-how-to-avoid-outofboundsexception/7356 "2019-01-09T15:35:36Z")

</div>

Hello: I have 16 images in the array repeated 4 times each and I can put them in an 8x8 board without problems. The magic is from anchnk in this link. I dont understand how but I suppose the expression that makes it po…

---

## [Perform a AABB hit test in 3D](https://discourse.processing.org/t/perform-a-aabb-hit-test-in-3d/7319)

<div class="topic-metadata">

**Author:** [@clankill3r](https://discourse.processing.org/u/clankill3r)\
**Replies:** 4\
**Last updated:** [January 9, 2019, 9:42am UTC](https://discourse.processing.org/t/perform-a-aabb-hit-test-in-3d/7319 "2019-01-09T09:42:47Z")

</div>

Is it possible to do a point hit test on a axis aligned bounding box after things like rotation are applied? Here is one of my current attempts, but i’m not sure if i’m after something that is possible at all. int w =…

---

## [Proceesing noob/amataeur help forum: Creating a specific program that involves an invisible square](https://discourse.processing.org/t/proceesing-noob-amataeur-help-forum-creating-a-specific-program-that-involves-an-invisible-square/7332)

<div class="topic-metadata">

**Author:** [@Sparktrooper55](https://discourse.processing.org/u/Sparktrooper55)\
**Replies:** 10\
**Last updated:** [January 9, 2019, 8:03am UTC](https://discourse.processing.org/t/proceesing-noob-amataeur-help-forum-creating-a-specific-program-that-involves-an-invisible-square/7332 "2019-01-09T08:03:28Z")

</div>

In processing, when it comes to creating projects or programs, I am not an expert whatsoever and I am more of a complete noob when it comes to this program and so I am trying to figure out a way to create a sketch where …

---

## [Noob help: trying to create a certain program in pde](https://discourse.processing.org/t/noob-help-trying-to-create-a-certain-program-in-pde/7311)

<div class="topic-metadata">

**Author:** [@Captainsparkles](https://discourse.processing.org/u/Captainsparkles)\
**Replies:** 7\
**Last updated:** [January 9, 2019, 7:17am UTC](https://discourse.processing.org/t/noob-help-trying-to-create-a-certain-program-in-pde/7311 "2019-01-09T07:17:30Z")

</div>

I’m a total noob when it comes to processing and so I am trying to figure out a way to create a sketch where an invisible square exists, and the user must find it by hovering the mouse throughout the canvas. When the mou…

---

## [Render grass like Minecraft, Zelda OOT](https://discourse.processing.org/t/render-grass-like-minecraft-zelda-oot/7340)

<div class="topic-metadata">

**Author:** [@BennyHacker](https://discourse.processing.org/u/BennyHacker)\
**Replies:** 0\
**Last updated:** [January 9, 2019, 2:06am UTC](https://discourse.processing.org/t/render-grass-like-minecraft-zelda-oot/7340 "2019-01-09T02:06:49Z")

</div>

Hello Forum. I am trying to render grass and other visuals similar to the method used in Minecraft and Zelda Ocarina of Time. Normally in P3D the invisible part of the image renders over top of the the other images, …

---

## [File Listing Order](https://discourse.processing.org/t/file-listing-order/7148)

<div class="topic-metadata">

**Author:** [@philspitler](https://discourse.processing.org/u/philspitler)\
**Replies:** 41\
**Last updated:** [January 8, 2019, 11:26pm UTC](https://discourse.processing.org/t/file-listing-order/7148 "2019-01-08T23:26:18Z")

</div>

Hi, I’m curious how Processing decides the order of files in a directory listing and if there is a way to sort alphabetical. I’m using the sample code below and the listing doesn’t seem to be alphabetical or by date mod…

---

## [Better grid Performance](https://discourse.processing.org/t/better-grid-performance/7314)

<div class="topic-metadata">

**Author:** [@blue-man](https://discourse.processing.org/u/blue-man)\
**Replies:** 16\
**Last updated:** [January 8, 2019, 6:17pm UTC](https://discourse.processing.org/t/better-grid-performance/7314 "2019-01-08T18:17:42Z")

</div>

Hello there, I createt a scaleable grid, that have no funktion at the Moment. But it is Scaleable and you can move it. Now my problem. I want to generate a Grid with 1000\*1000 rectangles (or more), but 1 000 000 rect…

---

## [Olympic rings, how to make them problems?](https://discourse.processing.org/t/olympic-rings-how-to-make-them-problems/7321)

<div class="topic-metadata">

**Author:** [@thatone](https://discourse.processing.org/u/thatone)\
**Replies:** 1\
**Last updated:** [January 8, 2019, 2:49pm UTC](https://discourse.processing.org/t/olympic-rings-how-to-make-them-problems/7321 "2019-01-08T14:49:23Z")

</div>

Hello, I’m trying to make the Olympic rings but I don’t know why the rings doesn’t make around just the stroke and instead just filling up. Would be honored if anybody could explain what I’m doing wrong? (Newbie still) …

---

## [Color not showing up](https://discourse.processing.org/t/color-not-showing-up/7289)

<div class="topic-metadata">

**Author:** [@Jrekz](https://discourse.processing.org/u/Jrekz)\
**Replies:** 8\
**Last updated:** [January 8, 2019, 1:04pm UTC](https://discourse.processing.org/t/color-not-showing-up/7289 "2019-01-08T13:04:38Z")

</div>

After I click inside the moving cube, the hit count rises but the color doesn’t change. However, when I click outside it the color changes to red and the miss count increases (it should be like that). What could cause t…

---

## [Help with creating smooth 2D movement](https://discourse.processing.org/t/help-with-creating-smooth-2d-movement/7272)

<div class="topic-metadata">

**Author:** [@mono](https://discourse.processing.org/u/mono)\
**Replies:** 4\
**Last updated:** [January 8, 2019, 12:45pm UTC](https://discourse.processing.org/t/help-with-creating-smooth-2d-movement/7272 "2019-01-08T12:45:25Z")

</div>

I have been attempting to implement some “smooth feeling” movement for a top-down action type game. The goal is to have the player slow down when changing direction and when stopping. The problem I have is the movement f…

---

## [Smooth Moving code](https://discourse.processing.org/t/smooth-moving-code/7126)

<div class="topic-metadata">

**Author:** [@MichaelPCgamer](https://discourse.processing.org/u/MichaelPCgamer)\
**Replies:** 9\
**Last updated:** [January 8, 2019, 7:37am UTC](https://discourse.processing.org/t/smooth-moving-code/7126 "2019-01-08T07:37:54Z")

</div>

I’m making a game separate from this specific code I just can’t get right… It’s for using the arrow keys to move around smoothly. But there seems to be a bad bug happening. float x = 100; float y = 100; void setup()…

---

## [Noob help: Making a circle grow by a mouse hovering over it and making it shrink when the mouse cursor is off of it](https://discourse.processing.org/t/noob-help-making-a-circle-grow-by-a-mouse-hovering-over-it-and-making-it-shrink-when-the-mouse-cursor-is-off-of-it/7299)

<div class="topic-metadata">

**Author:** [@Sparktrooper55](https://discourse.processing.org/u/Sparktrooper55)\
**Replies:** 2\
**Last updated:** [January 8, 2019, 6:24am UTC](https://discourse.processing.org/t/noob-help-making-a-circle-grow-by-a-mouse-hovering-over-it-and-making-it-shrink-when-the-mouse-cursor-is-off-of-it/7299 "2019-01-08T06:24:52Z")

</div>

I’m a noob at pde and I’m trying to figure out to make a circle grow when the mouse is hovering over it and make it shrink when the mouse cursor is off of it

---

## [Making part of a PImage transparent](https://discourse.processing.org/t/making-part-of-a-pimage-transparent/7295)

<div class="topic-metadata">

**Author:** [@BongoTurtle](https://discourse.processing.org/u/BongoTurtle)\
**Replies:** 9\
**Last updated:** [January 8, 2019, 4:58am UTC](https://discourse.processing.org/t/making-part-of-a-pimage-transparent/7295 "2019-01-08T04:58:00Z")

</div>

I would like to map an image to a sphere and have part of it transparent, but I can’t figure out how to make the image transparent. Is this possible? If not what would be the best way to do something like this. Thanks.

---

## [Collision between moving objects](https://discourse.processing.org/t/collision-between-moving-objects/7274)

<div class="topic-metadata">

**Author:** [@bernbernm](https://discourse.processing.org/u/bernbernm)\
**Replies:** 1\
**Last updated:** [January 7, 2019, 11:47pm UTC](https://discourse.processing.org/t/collision-between-moving-objects/7274 "2019-01-07T23:47:46Z")

</div>

Hey i’m using PImage to make my game and i’m trying to record a collision between my caterpillar and the birds to reset the score back to 0 if it happens. I know how to record collision with basic shapes such as rect bu…

---

## [How can i implement enemy shooting in this game?](https://discourse.processing.org/t/how-can-i-implement-enemy-shooting-in-this-game/6949)

<div class="topic-metadata">

**Author:** [@CodeMasterX](https://discourse.processing.org/u/CodeMasterX)\
**Replies:** 4\
**Last updated:** [January 7, 2019, 8:20pm UTC](https://discourse.processing.org/t/how-can-i-implement-enemy-shooting-in-this-game/6949 "2019-01-07T20:20:19Z")

</div>

Hi, I’ve been wondering how can I implement shooting to objects in my game named “obsticles”? Here is the code; (sry for like 100 tabs of it) int maxBCount = 1000; int obsticleCount = 10; Bullet b\[\] = new Bullet\[maxBCo…

---

## [\[SOLVED\] Scalable grid with rectangles](https://discourse.processing.org/t/solved-scalable-grid-with-rectangles/7256)

<div class="topic-metadata">

**Author:** [@blue-man](https://discourse.processing.org/u/blue-man)\
**Replies:** 6\
**Last updated:** [January 7, 2019, 2:24pm UTC](https://discourse.processing.org/t/solved-scalable-grid-with-rectangles/7256 "2019-01-07T14:24:27Z")

</div>

Hello my friends, I tried to create a grid with a scaleable size. So I wanted to use this few lines to create the rectangles. for (field2 = 0; field2 \< x; field2 = field2 + 1){ Box\[\] box = { new Box(10+ size/…

---

## [Path Finding Tiles Grid](https://discourse.processing.org/t/path-finding-tiles-grid/5395)

<div class="topic-metadata">

**Author:** [@ctrembla](https://discourse.processing.org/u/ctrembla)\
**Replies:** 3\
**Last updated:** [January 7, 2019, 10:49am UTC](https://discourse.processing.org/t/path-finding-tiles-grid/5395 "2019-01-07T10:49:14Z")

</div>

I’m making a new path finding enemy, that checks the tiles around him to see if he can walk on them. Sadly he doesn’t move or moves onto the wrong square. Can anyone tell me why my code not working? here the main page, …

---

## [Circle grows on left side of screen, not right](https://discourse.processing.org/t/circle-grows-on-left-side-of-screen-not-right/7243)

<div class="topic-metadata">

**Author:** [@Neutron](https://discourse.processing.org/u/Neutron)\
**Replies:** 6\
**Last updated:** [January 7, 2019, 12:25am UTC](https://discourse.processing.org/t/circle-grows-on-left-side-of-screen-not-right/7243 "2019-01-07T00:25:43Z")

</div>

Hello, I’m new to programming and I was just playing around with processing. I created a program where a circle follows your mouse and grows if it touches the edges of the screen. For some reason it works only when the …

---

## [Unsure if I'm programming this game to restart properly](https://discourse.processing.org/t/unsure-if-im-programming-this-game-to-restart-properly/7260)

<div class="topic-metadata">

**Author:** [@francium401](https://discourse.processing.org/u/francium401)\
**Replies:** 1\
**Last updated:** [January 7, 2019, 12:12am UTC](https://discourse.processing.org/t/unsure-if-im-programming-this-game-to-restart-properly/7260 "2019-01-07T00:12:53Z")

</div>

I attempted to reset the relevant variables back to it’s initial value whenever the space-bar button is pressed after the GAME OVER screen comes up, but something about it just isn’t right. After a second round of the ga…

---

## [Problem with passing vectors to next](https://discourse.processing.org/t/problem-with-passing-vectors-to-next/7077)

<div class="topic-metadata">

**Author:** [@Taxicletter](https://discourse.processing.org/u/Taxicletter)\
**Replies:** 25\
**Last updated:** [January 7, 2019, 12:00am UTC](https://discourse.processing.org/t/problem-with-passing-vectors-to-next/7077 "2019-01-07T00:00:44Z")

</div>

Hi, I have been working on an idea a while ago and want to pick up where I left. What I want to create is some kind of self-generating irregular pattern, existing of different polygons. I wrote the code for a random po…

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

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