I enjoy programming and have currently just entered into the world of programming and other things related. Things I am learning include: Processing, Python, and Blender.
Hello, I hate asking the forum, as I love figuring everything out myself, but I am completely stumped. It may be simple... but here it goes. I wrote a 2D array to create a grid. What I need to do now is select an individual square in the said grid and make it display. I'm trying to create a simple level editor and I think that a 2D array and a grid layout will work perfectly, except that I have no idea how I can achieve what I'm trying to do. I am able to wave my cursor around the screen and have specific squares turn blue, but what I want is the ability to hover over a square, and when clicked, it will stay lit up when I move my cursor. Also, for example, when I am done designing a level with this editor I want to be able to save the level and the only way I would think so is to somehow save which squares in the array are lit up to a text file and then when I load the game, it will load the level the user created. So, if someone could possibly push me in the right way, throw me some reading, anything to help rather than giving me the answer, that'd be AWESOME. If you need any code for what I've all ready written, I'd be happy to supply it. If worst comes to worst and only then, could one of you supply small solutions so that I still may figure it out myself?
I'm currently messing around with inkscape to create an svg file that will be the level design for my game. What I want to know, is how I can make children, or whatever they're called, in the svg file with inkscape. I want to be able to split the map up into a bunch of parts but have no prior experience with xml or inkscape. I've googled around and haven't found an answer if inkscape allows children, so I am asking you guys now. Does inkscape support children or am I going to have to find something else that does?
I haven't seen this posted before, but sorry if it has. I need to change the shape of the sketch window and have no idea how I would accomplish this. I've looked at
this post in exhibition but haven't been able to reproduce the circular windows it creates. I'm pretty new and what I came up with is probably completely wrong, but from my understanding this should just change the sketch window into a circle... so if someone could help, the help would be greatly appreciated.
Here's my code... pretty bad.
(I had no idea what was needed to be imported so I just kept the stuff that looked like it could do something).
Hey, I've finally decided to take a crack at arrays and decided to create a simple color palette for a little paint program I'm making. I've seen tons of different examples of how someone would go about doing and I have a question. I'm trying to build my color palette with two arrays. One 2D array to make columns and rows and one 1D array to store the colors. I got it to show the rectangles in a 2 by 10 table but can't seem to be able to get the fill of each rectangle to be different. I actually succeeded (partially) but changed it to get it working completely, failed, and forgot how I partially succeeded... So now I ask for help after looking at array tutorials and tons of examples of arrays and using a combination of arrays to make colors and multiple shapes but can't seem to figure it out. I'd really appreciate it if someone could tell me if this is possible or if I'm doing something wrong. Here's the code I have so far and what I've been trying to use to make my palette work.
balls[i] = new Ball(random(width), random(height), random(20, 40),int(random(3)), i, balls);
}
}
void draw() {
background(0);
for (int i = 0; i < numBalls; i++) {
balls[i].collide();
balls[i].move();
balls[i].display();
}
ellipse(mouseX,mouseY,30,30);
}
class Ball {
float x, y;
float diameter;
float vx = 0;
float vy = 0;
int index;
int id;
Ball[] others;
Ball(float xin, float yin, float din, int indexin, int idin, Ball[] oin) {
x = xin;
y = yin;
diameter = din;
index = indexin;
id = idin;
others = oin;
}
void display() {
fill(palette[index]);
ellipse(x, y, diameter, diameter);
}
}
The code that I tried to use to help me along is actually a stripped down version that had to do with "bubbles" following the mouse and I just cut it down until only what I needed was left. If you try to run it, it won't work because of all the stuff I deleted.
Oh and a little off topic, I have another post about controlP5 and have found nothing related to what I'm asking in that post and have had no replies... I started the topic in february... so I'd really appreciate the help. Here's the link:
ControlP5 Post
I have a quick question this time. I am using filter(INVERT) in a game. The game has multiple "themes" which change when certain amounts of time have gone bye. When this "theme" is activated it seems to slow the framerate down to about 23 frames per second. (I have a slo-mo button that changes the framerate to 23 and when the theme is activated and you press slo-mo nothing appears to change. That's why I know). Is it a known fact that the invert filter kills framerate and is there someway to get 60 fps again? If there isn't, is there someway to replicate the results of inverting the graphics without using the filter?
I am making a game that's going pretty good and has worked forever until today. I just pressed the "run" button to test the game again today and all of a sudden it tells me there is no library found for java.awt? I'm using java.awt.Robot so I need this, but my question is, will this affect my game at all? Have you had this problem? My game seems to run just as good but it just concerns me that it says it can't be found...
Hey, I am making a simple program and it's going fairly well, except that I need the program to always stay on top of all the other windows and applications. I know you can use "frame.setAlwaysOnTop(true);" but that's all it does. I need my program to be
running and on top of all the other programs. Is there any way to do this? I found an example of this in the exhibition but haven't been able to find out how he does it. You can check it out here:
This guy's magic!
Hey, haven't been able to find anything having to do with this... so here it goes. Is there a way for you to distinguish the two shift keys apart? I want to be able to use both the shift keys for different things with a game I'm making.
Hey, I found this example of simple collision detection:
Simple Collision and really liked it and decided to borrow it and mold it to my needs and to also jump into inheritance. Most of the time it works extraordinary but every once-in-awhile it goes haywire and decides to detect a random collision although your character isn't even close to the ellipse/square. So, basically, my question is there a more efficient way of doing simple collision detection or a way to fix this? I think this might be part of the problem, that the glitch tends to only happen on my Mac, V.10.5.8 along with a problem with my robot script... I don't really want to post the code, so it would be helpful if you could answer with just knowledge or I could provide more detail.
Thanks greatly,
TheGamersHaven
P.S. It doesn't really happen when I am on my windows 7 so... that gives me more proof that the problem is more on the mac end of it.
Hey guys, kind of a random question here, but I have been using a Dell laptop with Windows 7 for a few months now and whenever I press the caps-lock key (or actually, any other special key like that) a pop up appears. That wouldn't bug me much if it weren't for it's abilities to eat your mouse's position. Whenever I'm typing and I accidentally or intentionally press it the place where I had my cursor is gone and it is getting extremely annoying... So basically, my question is, how do I get rid of that darn pop up that is completely useless?
P.S. I have googled around and don't really trust other peoples replies on random forums without reliable resources... I really don't want to screw up my computer, since almost all of the responses are different and have something to do with uninstalling some thing.
Hey, I am making a simple survival game like, for example, Robot Unicorn Attack but without the fancy graphics. Well actually... your just a ball and you have to dodge balls and squares. Well, I had just started messing around with inheritance and I am trying to setup collision detection and it seems to be going well, just that the ball that's supposed to follow your mouse doesn't want to show anymore. I've been messing around with it, trying to get it to show, for about a day now with no sign of success. I would appreciate all the help I could get. Without posting all the code as it is getting pretty lengthy, I think I have gotten down to the area where it doesn't show. I'll post the snippet of code and if you need more, I will gladly supply it.
Hello, I am having a problem making a secondary window I made have no decoration. I originally scripted it on a mac and it worked fine but when I took my flash drive and ran the same script on windows 7 my second window shrank to the default really tiny square thing. I have no idea why and would seriously appreciate if someone could help me. The code is below.
Oh and without having to make two threads, what would be the best way to create 25 rectangles that interact with the mouse when clicked and when a random button (as in a button that you press, not when the user hits a random key) is pressed, they randomize their x and y coordinates, but in a grid. Once you pressed one rectangle, you would select another and then it would compare predefined values and check if they matched. Would I use a class or an array... I haven't experimented with arrays much and help would also be very appreciated.
I am just starting to fool around in 3D and have been experimenting with controlP5 and can't figure out why this happens. The slider and peasyCam example of controlP5 works fine and nothing goes wrong, but when I copy exactly as they have it, the slider follows the 3D shape. This is kind of hard to explain, so you'll probably just have to run the code and see what I'm talking about. Any help would be nice, and if this has already been posted, then I am sorry, because I couldn't find it anywhere.
I am creating an offline highscore system for a simple "survive" game. Here's how it works. You start the game and have two displays called "score" and "highscore". I coded it so that the score will rapidly rise and if highscore is less than score highscore will equal score. That works. I have also made it so that it will save the highscore to a .dat file. I used the examples in the reference to read and print to text files. It works perfectly and will save your highscore once you press "esc" and when you load the game again, it will load your highscore. Now this is where it doesn't work. If you quit out of the game when you've loaded the highscore and you haven't beaten your previous highscore and you quit out, the game will erase the highscore the next time you boot the game. If you
have beaten the highscore and quit out it will save the highscore for the next time you load the game. I can't figure out why it does this, from my understanding it should always save the highscore... help would be extremely appreciated. If you need any code, I will be glad to provide it. I've searched through the forum (old and new) and haven't found anything that could help my problem.
Hey, I have more of a general question today. I've been hearing these terms quite often and I know what they are, but I don't know what the differences are between functions and methods (people use that term to mean the same thing?) and also, could someone explain when one should use a class rather than a function. I have a vague idea and would like to know more for clarity's sake.
I have defined a boolean variable "retro" false and I have my code setup so that if you press and hold the "r" key it will set it to "true" and if you release the "r" key it will set it to false and it will print if the variable is true or false. Well, when I ran the sketch it was already saying retro equaled true before I had pressed anything. Here are a few snippits of code if you need them.
boolean retro = false;
void ball() {
if (retro = false) {
smooth();
noStroke();
fill(255,50);
rectMode(CORNER);
stroke(0);
rect(0,0,width,height);
fill(0);
ellipse(mouseX,mouseY,10,10);
}
if (retro = true) {
noSmooth();
fill(0,50);
rectMode(CORNER);
rect(0,0,width,height);
stroke(0,255,0);
ellipse(mouseX,mouseY,10,10);
}
}
void keyPressed() {
if (key == 'r' || key == 'R') {
retro = true; //Enables retro mode.
}
}
void keyReleased() {
if (key == 'r' || key == 'R') {
retro = false; //Disables retro mode.
}
}
I've been looking over my code for awhile and I couldn't find the reason why it isn't working... If you need anything else feel free to ask. I won't be able to respond, though, for a five to six hours because of school.
Also, if you could help me out with a previous problem, that would be just great.
I have just encountered the "OutOfMemoryError" and would like to know if I should increase the memory. Right now I have had the Processing memory set at the default since I have downloaded it and would like to know what is the best amount of memory to allow Processing. Also, do I even need to allow more memory? Below is a snip-pit of my code.
int cSize = 500;
void keyReleased() {
if (key == 's' || key == 'S') {
canvas.save("Test.jpg");
}
if (key >= 1) {
cSize = (key*100);
startCanvas();
println(key);
}
}
//Random assortments of code....
void startCanvas() {
canvas = createGraphics(cSize+75,cSize+75,P2D);
canvas.beginDraw();
canvas.background(255);
canvas.smooth();
canvas.noStroke();
canvas.fill(0);
canvas.endDraw();
}
When I run the sketch like it is it runs out of memory, but when I comment out the part where I call startCanvas() it works fine. My question is do I need to up the memory and what is the best amount of memory to allow Processing. If you need more code, or more explanation, I will gladly provide.
P.S. I am using Mac OS X and my main computer uses Windows, so I would also like to know if that would affect anything. I won't be able to respond for at least five to six hours because of school and probably interruptions.
I am making a simple paint program and I finally got around to making the "s" key save the image you have drawn. I have made the sketch resizable and made a max height/width the sketch window could be. Saving the image works fine if the window is the max size I set it, but if I make the window the max size and then draw and then decrease the size and then try to save, it only saves what is seen. That makes sense, but when I made it if you press the "s" key, it will call frame.setSize() and then set it to my max width/height and
then save the image. Instead of saving the the image the size of the window, it saves the the part of the image that you originally pressed "s" on... I've tried a lot of things but I can't figure out how to make it so when you press the "s" key and the window is less than the max size, it will resize and then save the image's new size. If someone could help me, I would be really grateful.
For a first project I am creating a (very) simple paint program and one of the first things even a basic paint program needs is that it needs to be resizable. I am using frame.setResizable(); to make my sketch window... resizable. But, when I run the program and make the window bigger, the canvas stays the same size while the window gets bigger. I didn't really explain that good.
Ok, the window looks like this -> [] ___
when I first run it. When I resize it, the window then looks like this -> |___|
But the canvas that your draw on still stays like this -> []
even though your window is bigger.
So my question is, how can I get the drawing canvas to resize with the window?
Thanks in advance,
TheGamersHaven
___________________________________________________________________
Do you know what you just lost?
Hey, I want to learn processing and I've tried searching the forums and this question hasn't already been posted. What is the best and possibly fastest way to learn processing? Is it a book, or is it a tutorial on the internet? I want to know what the people think is the best way to learn, instead of biased opinion on some website. Thanks in advance,
TheGamersHaven
___________________________________________________________________
Do you know what you just lost?
I have Windows XP, Vista, 7 and it works fine and nothing pops up in the evil red text of doom. *The error message thing*
I downloaded the Mac OS X version 1.2.1 of processing and when I ran my simple drawing script, the red text said this "Cannot run Java in 32 bit mode. Continuing in 64 bit mode." I know what this means but why? When my program runs it works normally just that it is really slow. On all my other Windows it works like a charm. Can someone enlighten me on my problem or is it just Mac OS X running slowly? Thanks in advance, TheGamersHaven
___________________________________________________________________
Do you know what you just lost?
I know this is a noobish question and that I have been using Processing for a few months now, but I have
never known how to save. If you would be kind enough to tell me how to save my sketches to the sketch folder that would be really helpful... oh, and if you could tell me where to save my font for a game I am making. Thanks in advance,
TheGamersHaven
___________________________________________________________________
Do you know what you just lost?
Hey, I'm a very new user to processing and I am trying to make a very basic art program. Right now I want to know how to make an eraser, which starts when you press backspace. I've tried using shapes like the rectangle and the ellipse but they both have a black outline and since I'm using pmouseX & Y the shapes get
REALLY deformed. So if you could help please do so.