I'm writing a game for Android using processing, and have decided to write my own menu system from scratch. Right now, every time the back button is pressed the game quits to the android home screen. I want to be able to use the back button to navigate my menu system (like in practically every other android app). So how can I stop it from quitting to the home screen when the back button is pressed?
I recently bought a RAZR and wanted to start developing for it. When I hit "run on device", processing compiles everything fine but then says "Waiting for device to become available..." and nothing ever happens on the phone. The device is in debug mode and I believe the USB drivers are installed correctly. What am I doing wrong?
I made a program that uses GLgraphics and the problem is that when I close the program, java.exe doesn't close so I have to manually end the process every time. The window will close, but java.exe will still be running, meaning I can't run the sketch again until I close it. Does anybody know how to fix this?
I was wondering how I would stream from an online radio station using processing (specifically
technobase.fm). I'd like to be able to use the minim audio library on the stream. Windows Media Player can stream it using an .asx file. The file for technobase looks like this:
I'm making a maze game, and right now I'm adding a lighting engine to it. Before I tell you about the lighting glitch, let me explain how the code works. The maze is generated during setup() and stored in a 2D array of ints called maze. The value of a certain index ( [x][y] ) represents the type of that specific cell. The format is like this:
int maze[x][y]
0 - cell unvisited 1 - cell visited 2 - wall unremoved 3 - wall removed 4 - part of the solution
In the draw() function, the maze is displayed and you can run through it with the arrow keys. To make it more of a challenge, I've added a lighting system that uses a breadth first search style approach with nodes (
http://en.wikipedia.org/wiki/Breadth-first_search). The code is rather simple, basically it starts with the player's position as the first node, then spreads outwards a certain number of times based on the value of visibility, with the color getting dimmer as it spreads more. The nodes are all added to a string so I can use match() to check if a certain node was already visited. Code:
visibility = 40; for(int a = 0; a <= visibility; a++) { ArrayList<String> newNodes = new ArrayList<String>(); for(int i = 0; i < nodes.size(); i++) { int nX = int(nodes.get(i).split(" ")[0]); int nY = int(nodes.get(i).split(" ")[1]);
visitedCells += nX + " " + nY + ",";
int cVal = (int) ((1.0 - a / ((float) visibility)) * 255.0); fill(255, 255, 255, cVal); rect(nX * drawSize, nY * drawSize, drawSize, drawSize);
boolean isCell(int xp, int yp) { if((xp >= 0) && (yp >= 0) && (xp <= sizeX - 1) && (yp <= sizeY - 1)) { // not a wall return maze[xp][yp] != 2; } else { // outside the bounds of the maze, return false return false; } }
The problem is that the light sometimes just drops off at a certain node apparently at random. Here's 3 examples of this happening:
I seriously don't know why this is happening. My guess is that the problem lies with the visitedCells string, but I don't see anything wrong with it. Any ideas?