# Coding Questions

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

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

**Page:** 49

---

## [Check if variable is a prime](https://discourse.processing.org/t/check-if-variable-is-a-prime/31216)

<div class="topic-metadata">

**Author:** [@MoonAlien822](https://discourse.processing.org/u/MoonAlien822)\
**Replies:** 24\
**Last updated:** [July 13, 2021, 7:47pm UTC](https://discourse.processing.org/t/check-if-variable-is-a-prime/31216 "2021-07-13T19:47:01Z")

</div>

how to check if x is a prime?

---

## [Allow User to Resize the Window](https://discourse.processing.org/t/allow-user-to-resize-the-window/31212)

<div class="topic-metadata">

**Author:** [@dtools22](https://discourse.processing.org/u/dtools22)\
**Replies:** 2\
**Last updated:** [July 13, 2021, 5:41pm UTC](https://discourse.processing.org/t/allow-user-to-resize-the-window/31212 "2021-07-13T17:41:17Z")

</div>

Hello All, I’m creating a program and I would like the user to be able to resize the screen at their convenience. I understand the basics of how to do this with objects and their positioning on the screen but I’m a litt…

---

## [X and y don't even out](https://discourse.processing.org/t/x-and-y-dont-even-out/31214)

<div class="topic-metadata">

**Author:** [@MoonAlien822](https://discourse.processing.org/u/MoonAlien822)\
**Replies:** 3\
**Last updated:** [July 12, 2021, 8:32pm UTC](https://discourse.processing.org/t/x-and-y-dont-even-out/31214 "2021-07-12T20:32:32Z")

</div>

i wrote a code that should, generate a random x, from 1-10 and then make a y the number that it needs to complete 10. it then should try to devide it by something it can be devided by. then it shows a visual for me to s…

---

## [How can i animate the D so instead of having the D stretched i see how it stretches? (this is the code i have)](https://discourse.processing.org/t/how-can-i-animate-the-d-so-instead-of-having-the-d-stretched-i-see-how-it-stretches-this-is-the-code-i-have/31186)

<div class="topic-metadata">

**Author:** [@tommyba](https://discourse.processing.org/u/tommyba)\
**Replies:** 1\
**Last updated:** [July 12, 2021, 8:16am UTC](https://discourse.processing.org/t/how-can-i-animate-the-d-so-instead-of-having-the-d-stretched-i-see-how-it-stretches-this-is-the-code-i-have/31186 "2021-07-12T08:16:33Z")

</div>

PFont myFont; void setup() { size(1200, 1200); // Uncomment the following two lines to see the available fonts //String\[\] fontList = PFont.list(); //printArray(fontList); myFont = createFont(".SFNS-Bold", 125); fr…

---

## [How do i add characters in a string, i have 11 digits in my string and i am supposed to add the odd number positions](https://discourse.processing.org/t/how-do-i-add-characters-in-a-string-i-have-11-digits-in-my-string-and-i-am-supposed-to-add-the-odd-number-positions/31174)

<div class="topic-metadata">

**Author:** [@Tay](https://discourse.processing.org/u/Tay)\
**Replies:** 10\
**Last updated:** [July 12, 2021, 4:00am UTC](https://discourse.processing.org/t/how-do-i-add-characters-in-a-string-i-have-11-digits-in-my-string-and-i-am-supposed-to-add-the-odd-number-positions/31174 "2021-07-12T04:00:14Z")

</div>

please format code with \</\> button \* homework policy \* asking questions How do i add characters in a string, i have 11 digits in my string and i am supposed to add the odd number positions

---

## [Help with for(SOLVED)](https://discourse.processing.org/t/help-with-for-solved/31184)

<div class="topic-metadata">

**Author:** [@ultimakey](https://discourse.processing.org/u/ultimakey)\
**Replies:** 5\
**Last updated:** [July 11, 2021, 10:54pm UTC](https://discourse.processing.org/t/help-with-for-solved/31184 "2021-07-11T22:54:06Z")

</div>

thank you TfGuy44 for helping me out!! (SOLVED)

---

## [How to say: if the result is zero then the digit is zero otherwise it is 600](https://discourse.processing.org/t/how-to-say-if-the-result-is-zero-then-the-digit-is-zero-otherwise-it-is-600/31180)

<div class="topic-metadata">

**Author:** [@Tay](https://discourse.processing.org/u/Tay)\
**Replies:** 4\
**Last updated:** [July 11, 2021, 8:53pm UTC](https://discourse.processing.org/t/how-to-say-if-the-result-is-zero-then-the-digit-is-zero-otherwise-it-is-600/31180 "2021-07-11T20:53:38Z")

</div>

I am trying to use the if function to say if the result is zero then the digit is equals to zero otherwise it is 600 but its giving me a boolean error no matter what I try. This is my code so far int result= mult%10;…

---

## [Drawing chains using loops](https://discourse.processing.org/t/drawing-chains-using-loops/31182)

<div class="topic-metadata">

**Author:** [@matto](https://discourse.processing.org/u/matto)\
**Replies:** 3\
**Last updated:** [July 11, 2021, 8:43pm UTC](https://discourse.processing.org/t/drawing-chains-using-loops/31182 "2021-07-11T20:43:52Z")

</div>

Am working on a code using loops, basically what I want to do is draw a chain of circles that stretches from the center of the screen to the mouse position. but I can’t make the chain follow the mouse this is my code so…

---

## [Spin rectangles in place](https://discourse.processing.org/t/spin-rectangles-in-place/31145)

<div class="topic-metadata">

**Author:** [@seldomcoder](https://discourse.processing.org/u/seldomcoder)\
**Replies:** 5\
**Last updated:** [July 10, 2021, 7:46pm UTC](https://discourse.processing.org/t/spin-rectangles-in-place/31145 "2021-07-10T19:46:50Z")

</div>

I have created a spiral of rectangles. Now, I want those rectangles to spin in their respective places. How do I go about it? I have attached the code here: \< // import the library import com.hamoid.\*; // create a new…

---

## [Rotating 3D-objects in PGraphics for hires output](https://discourse.processing.org/t/rotating-3d-objects-in-pgraphics-for-hires-output/31155)

<div class="topic-metadata">

**Author:** [@ArjanBytez](https://discourse.processing.org/u/ArjanBytez)\
**Replies:** 2\
**Last updated:** [July 10, 2021, 7:02pm UTC](https://discourse.processing.org/t/rotating-3d-objects-in-pgraphics-for-hires-output/31155 "2021-07-10T19:02:37Z")

</div>

I’m trying to achieve something which should be fairly easy, but after checking the forums I still can’t get it to work: making 3D-objects to rotate in hires imagery in Processing (v3 in this case, v4 doesn’t seem to wor…

---

## [Single rectangle button](https://discourse.processing.org/t/single-rectangle-button/30948)

<div class="topic-metadata">

**Author:** [@PARINAZ129](https://discourse.processing.org/u/PARINAZ129)\
**Replies:** 4\
**Last updated:** [July 10, 2021, 11:30am UTC](https://discourse.processing.org/t/single-rectangle-button/30948 "2021-07-10T11:30:36Z")

</div>

Dear As you or your co-workers suggested to me,I tried to change my code.at this time I want to make a single rect button that has been filled with multiple colors as it being pressed however it doesn’t work. may I ask …

---

## [Parabolic Curve](https://discourse.processing.org/t/parabolic-curve/31122)

<div class="topic-metadata">

**Author:** [@bopStu77](https://discourse.processing.org/u/bopStu77)\
**Replies:** 10\
**Last updated:** [July 10, 2021, 2:37am UTC](https://discourse.processing.org/t/parabolic-curve/31122 "2021-07-10T02:37:06Z")

</div>

I’m new to coding and processing. I have no idea how to begin this code, I wonder how I should start? This what I need to get below. please format code with \</\> button \* homework policy \* asking questions

---

## [2 random points on the circumference of a circle](https://discourse.processing.org/t/2-random-points-on-the-circumference-of-a-circle/31129)

<div class="topic-metadata">

**Author:** [@gentle\_ben](https://discourse.processing.org/u/gentle_ben)\
**Replies:** 4\
**Last updated:** [July 9, 2021, 1:09pm UTC](https://discourse.processing.org/t/2-random-points-on-the-circumference-of-a-circle/31129 "2021-07-09T13:09:21Z")

</div>

Hi, hope you can help me. I’m sure this is simple. I’ve found many references to getting random point on the edge of circle using (cos(angle)\*radius, sin(angle)\*radius) but what i have come up with generates points that…

---

## [I'm trying to make an Agar.io copy](https://discourse.processing.org/t/im-trying-to-make-an-agar-io-copy/7327)

<div class="topic-metadata">

**Author:** [@Krokido](https://discourse.processing.org/u/Krokido)\
**Replies:** 7\
**Last updated:** [January 9, 2019, 9:37am UTC](https://discourse.processing.org/t/im-trying-to-make-an-agar-io-copy/7327 "2019-01-09T09:37:08Z")

</div>

I am new in programming and I wanted to try to make Agar.io copy, but I do not know how to create food. My code

---

## [Create Multiple Diagonal Lines](https://discourse.processing.org/t/create-multiple-diagonal-lines/31121)

<div class="topic-metadata">

**Author:** [@bopStu77](https://discourse.processing.org/u/bopStu77)\
**Replies:** 2\
**Last updated:** [July 9, 2021, 1:28am UTC](https://discourse.processing.org/t/create-multiple-diagonal-lines/31121 "2021-07-09T01:28:15Z")

</div>

I’m new to processing and coding. I’m wondering how you get this done.

---

## [Download Videos from websites for example "animefrenzy"](https://discourse.processing.org/t/download-videos-from-websites-for-example-animefrenzy/31106)

<div class="topic-metadata">

**Author:** [@Flolo](https://discourse.processing.org/u/Flolo)\
**Replies:** 11\
**Last updated:** [July 8, 2021, 8:32pm UTC](https://discourse.processing.org/t/download-videos-from-websites-for-example-animefrenzy/31106 "2021-07-08T20:32:20Z")

</div>

Hey, I want to write a program with which you can download and watch the series hunter x hunter. I just need help with the download as I just can’t find a solution. I know I need “more” java for this problem. That’s why …

---

## [Repeat text x times](https://discourse.processing.org/t/repeat-text-x-times/31032)

<div class="topic-metadata">

**Author:** [@MoonAlien822](https://discourse.processing.org/u/MoonAlien822)\
**Replies:** 25\
**Last updated:** [July 8, 2021, 11:34am UTC](https://discourse.processing.org/t/repeat-text-x-times/31032 "2021-07-08T11:34:41Z")

</div>

how do i print a letter, x times? for example, an a repeated 6 times would be aaaaaa

---

## [Random Achievement system](https://discourse.processing.org/t/random-achievement-system/31063)

<div class="topic-metadata">

**Author:** [@Gyrosis](https://discourse.processing.org/u/Gyrosis)\
**Replies:** 2\
**Last updated:** [July 7, 2021, 2:33pm UTC](https://discourse.processing.org/t/random-achievement-system/31063 "2021-07-07T14:33:09Z")

</div>

How would I create an achievement system so when I kill an X amount of random enemies in a random X amount of time.

---

## [Rotating the sprite using mouse](https://discourse.processing.org/t/rotating-the-sprite-using-mouse/30997)

<div class="topic-metadata">

**Author:** [@millionish](https://discourse.processing.org/u/millionish)\
**Replies:** 16\
**Last updated:** [July 6, 2021, 11:18pm UTC](https://discourse.processing.org/t/rotating-the-sprite-using-mouse/30997 "2021-07-06T23:18:39Z")

</div>

Hello! I want my sprite’s front to rotate in the direction of the mouse pointer. But it isn’t doing so properly (as you can see in the pic). The pointer is behind the car, but I want it to be in front of the car. I’ve tr…

---

## [Several elements interactivity](https://discourse.processing.org/t/several-elements-interactivity/31081)

<div class="topic-metadata">

**Author:** [@humano](https://discourse.processing.org/u/humano)\
**Replies:** 4\
**Last updated:** [July 6, 2021, 9:44pm UTC](https://discourse.processing.org/t/several-elements-interactivity/31081 "2021-07-06T21:44:17Z")

</div>

Hi there! I have learned how to move an element with mouseX and mouseY, in this case, a red dot. Now I want to stop red dote and move another blue dot with my finger. ¿How could I do it? Thanks! void setup() { size(10…

---

## [Is NFC possibile on Processing for Android?](https://discourse.processing.org/t/is-nfc-possibile-on-processing-for-android/31068)

<div class="topic-metadata">

**Author:** [@Z4buz4](https://discourse.processing.org/u/Z4buz4)\
**Replies:** 5\
**Last updated:** [July 6, 2021, 11:09am UTC](https://discourse.processing.org/t/is-nfc-possibile-on-processing-for-android/31068 "2021-07-06T11:09:36Z")

</div>

Good evening, is there a (hopefully simple) way to use NFC on Processing for Android? I was reading from the tutorials that for sensors other than the accelerometer, is suggested to use the Ketai library but i’ve also f…

---

## [Timer without delay()](https://discourse.processing.org/t/timer-without-delay/31080)

<div class="topic-metadata">

**Author:** [@millionish](https://discourse.processing.org/u/millionish)\
**Replies:** 1\
**Last updated:** [July 6, 2021, 3:11am UTC](https://discourse.processing.org/t/timer-without-delay/31080 "2021-07-06T03:11:45Z")

</div>

I have written a code for a stopwatch (when button pressed, it starts), but I have used delay(). Is there a way to perform it without delay()? lcd.setCursor(0, 1); if (buttonValue1 == LOW) { startTime = millis(); …

---

## [Straight line pattern with random position](https://discourse.processing.org/t/straight-line-pattern-with-random-position/31075)

<div class="topic-metadata">

**Author:** [@humano](https://discourse.processing.org/u/humano)\
**Replies:** 1\
**Last updated:** [July 5, 2021, 6:06pm UTC](https://discourse.processing.org/t/straight-line-pattern-with-random-position/31075 "2021-07-05T18:06:02Z")

</div>

Hi there! I have made this straight line pattern that you can see in my code, looking a tutorial. Now I want to change the position of the pattern and make it random, it would be very difficult? float x=100; void …

---

## [How to draw linear (input) data points around circular shape](https://discourse.processing.org/t/how-to-draw-linear-input-data-points-around-circular-shape/31015)

<div class="topic-metadata">

**Author:** [@domha91](https://discourse.processing.org/u/domha91)\
**Replies:** 4\
**Last updated:** [July 5, 2021, 3:09pm UTC](https://discourse.processing.org/t/how-to-draw-linear-input-data-points-around-circular-shape/31015 "2021-07-05T15:09:15Z")

</div>

Sorry if the title is a little too abstract but this is a hard concept for me to put into words. The code is not too difficult but my main issue is the maths. It is based on receving OSC messages from TidalCycles, liveco…

---

## [Rotating using potentiometer issue](https://discourse.processing.org/t/rotating-using-potentiometer-issue/31064)

<div class="topic-metadata">

**Author:** [@millionish](https://discourse.processing.org/u/millionish)\
**Replies:** 6\
**Last updated:** [July 5, 2021, 12:30pm UTC](https://discourse.processing.org/t/rotating-using-potentiometer-issue/31064 "2021-07-05T12:30:38Z")

</div>

I could actually implement the rotation of the car using arduino’s potentiometer (like a steering). But the issue is when I rotate the car with potentiometer, it doesn’t drive in that direction, but instead drives in mou…

---

## [How can I use a variable to represent an array's length in the class?](https://discourse.processing.org/t/how-can-i-use-a-variable-to-represent-an-arrays-length-in-the-class/31060)

<div class="topic-metadata">

**Author:** [@karenChip](https://discourse.processing.org/u/karenChip)\
**Replies:** 2\
**Last updated:** [July 5, 2021, 6:20am UTC](https://discourse.processing.org/t/how-can-i-use-a-variable-to-represent-an-arrays-length-in-the-class/31060 "2021-07-05T06:20:05Z")

</div>

Hello guys, I’m trying to write an object with arrays in it. but i want to make the length of the array as a variable so i can manipulate in the parameters. so i set the array length as n in this code. Snake snake1; v…

---

## [Four rectangle buttons](https://discourse.processing.org/t/four-rectangle-buttons/31047)

<div class="topic-metadata">

**Author:** [@PARINAZ129](https://discourse.processing.org/u/PARINAZ129)\
**Replies:** 5\
**Last updated:** [July 4, 2021, 8:38pm UTC](https://discourse.processing.org/t/four-rectangle-buttons/31047 "2021-07-04T20:38:03Z")

</div>

Hello I wanted to make 4buttons that show individual color. however, when I click on each of them all buttons are turned on together. I know my problem is with the draw event but I don’t know what should I do. may I ki…

---

## [Creating Save Functionality for Embedded Objects](https://discourse.processing.org/t/creating-save-functionality-for-embedded-objects/31027)

<div class="topic-metadata">

**Author:** [@dtools22](https://discourse.processing.org/u/dtools22)\
**Replies:** 7\
**Last updated:** [July 4, 2021, 6:17pm UTC](https://discourse.processing.org/t/creating-save-functionality-for-embedded-objects/31027 "2021-07-04T18:17:19Z")

</div>

Hello All, I am working on a “Save” function for my current program. After doing a little research it seems the method is to have any meaningful data from the program save to some external source like a text document o…

---

## [Overlaping clickable buttons](https://discourse.processing.org/t/overlaping-clickable-buttons/31044)

<div class="topic-metadata">

**Author:** [@Kingjuleyann](https://discourse.processing.org/u/Kingjuleyann)\
**Replies:** 4\
**Last updated:** [July 4, 2021, 5:49pm UTC](https://discourse.processing.org/t/overlaping-clickable-buttons/31044 "2021-07-04T17:49:25Z")

</div>

hello world, I am currently making a game using processing but a have a bug I can’t solve: I have made a main menu that includes a clickable button leading to a submenu for single player game modes. when I click on the m…

---

## [Add ball and move it with cursor until a line](https://discourse.processing.org/t/add-ball-and-move-it-with-cursor-until-a-line/30975)

<div class="topic-metadata">

**Author:** [@kevin20](https://discourse.processing.org/u/kevin20)\
**Replies:** 2\
**Last updated:** [July 1, 2021, 1:37am UTC](https://discourse.processing.org/t/add-ball-and-move-it-with-cursor-until-a-line/30975 "2021-07-01T01:37:38Z")

</div>

hey guys! first of all i want to create the game skee ball in processing. i already have a ball as cursor but i want that the ball is fly after throwing line and not be fixed on the cursor. my code atm: int wurfstaer…

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

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