I came across an idea on making two or more objects (Ellipses in my program), of the same class interact with each other.
That means two ellipses bouncing off of each other.
How do I have the same class interact with itself?
I'm trying too develop a program that would do a perfect resize of the image without blurs. (This might relate to the photo editing software I use, but vectors would be useful).
What I want to do, is have the program use get() for each pixel, then immediately save it as part of the vector.
How would I do that? I'm not eager to use libraries, no matter how much harder the code gets.
I'm trying to make a text input, and when it reaches a certain border, I want the program to make a new line.
Here's the problem: Every time the program reaches the border, at first it does what it was told to do, but then it does some unnecessary things. It just makes a new line, and the text hasn't even reached the border.
I knew this was because of the textWidth() method I used. I made some changes, and it still acts up.
I'm sure you all know about save(), and what it is used for.
But I don't want to use save(), as it saves what is shown currently on the sketch.
I want to save an image to a defined folder, without having to bring up the image that is needed to save.
How do I do that?
I've been recently trying to develop a random direction generator "prototype", and an issue comes up.
No exception, but rather the program isn't doing what it's supposed to do.
I want to stop the random() function/action for generating more numbers in this code:
int r = 2;
byte dir;
while (r > 1) {
dir = byte(floor(random(4)));
r = 0;
println(dir);
}
Nothing complicated, but the program continuously prints out a random number, when it should've stopped.
Why is it doing that?
I read an article that true random is generated through atmospheric noise, and like many people, I don't think that pseudo-random, or the random generated by the computer, will be sufficient.
My question is: Is it possible to use the computer's microphone, if it has one, to generate a semi to true random integer or floating point number?
I'm starting with Object Oriented Programming, and I think I have a more or less appropriate understanding of OOP, but I can't say for sure, so I need to make things clear.
So, OOP is, in simple terms, is a way to have a certain type object, then call methods to use that object once to multiple times, and if the object class has random direction and/or speed, each instance of that object will look like it has a mind of it's own. Am I thinking the right way?
Having dealt with the previous question (
Window Resize Limit), I now have a new question.
If you try to use the code in the link posted by me, you will see that the frame doesn't update immediately along with you resizing the sketch window. Only when you let go of the sketch, it will resize the buttons/rectangles accordingly.
My question is: Is there a way to have the screen automatically update every single frame along with you resizing it?
This post is, lucky for me, is not a problem like all of my previous posts, but a question about frame.setResizable().
I'm working on a GUI system that will resize itself according to how you change the window size.
My question is: Is there a way to limit the amount that the screen can be shrunk?
That would help out me, and soon, the users, as there is no purpose in a sketch window smaller than the width of my pinky. Is there a way to do this, and how?
I just had the array problem more or less dealt with (
Saving Game Level), but now it has given me a new problem.
I have the program rearranging the 2D array into a 1D array, and I'm using the Processing reference example for loadBytes() to test the efficiency and effectiveness of saveBytes() in my program (
loadBytes()).
What saveBytes() is actually doing, by the looks of it, is that it is mirroring the entire array on some sort of diagonal line.
Or the main program overall is made improperly.
Here are some images of what is happening:
This is the way the main
program shows the level:
Then the reference program
interprets the array like this:
Which is the same as this:
It's as though the program flipped the image vertically, then turned it quarter turn clockwise.
Why is the main program saving the array like this?
Code in the next post.
While fiddling with saving files (
Saving Game Level), an idea came.
I want to know if it is possible to create temporary array variables using for() loops during the running sketch, so I could save each level as a 2D array in-game, and recover them later. It would be a hassle to hard-code 100 array variables into the game, in case the user would like to play that many levels.
Is this possible?
Before I get into the question, I'll provide a quick back-story.
I'm making a game that has multiple levels, and each level is generated randomly.
The user has a choice of how big the levels are (width and height).
What I want to do is save each level once the level has been made.
I'm thinking that the saveStrings() method might work, but I don't know how to get it to work.
If anyone out there can either tell me how to use saveStrings(), or show me a new method I could use in my code, that would be great.
Thanks,
- MenteCode.
-P.S Each level is, and needs to be stored as a 2D array.