Java application Swing drawing no Snake - java

I have programmed the game "Snake" in Java, but when I execute my program my snake does not appear. When I run my application, the game appears with writing, colors, and the apple the snake should eat. Just not the snake.
The program is here: https://github.com/ryanhillman/Colorful-Snake
This is what comes up when I run my program
Can anyone figure out what is causing my game to start incorrectly?
Thank you

Related

Problems with WallTile in JAVA

I'm trying to create a Game Engine in java, as a way of learning in a course I'm attending, and now I'm learning how to program collisions between the player and a wall. But there's one problem I haven't seen anyone having, that basically my character runs into a wall and he just stops responding. And the way I say it, it's not like the program stopped responding, it's more like leaning against a wall the controls stop working, because even though everything seems to be stopped, the FPS keeps counting.
Here are screenshots of the parts I think are most important to show for this specific issue:
enter image description here
enter image description here
Here's the file and codes on github for a deeper look:
https://github.com/TheAwesomeCake/Game-Engine.git

How to create java window without a GUI

I have been given an assignment for uni to make a chess game without using a GUI(swing or Java FX)
I have made the game using the AWT Canvas Class. However, I cannot figure out how to actually make a java window or frame for the game to run in without using a GUI?
Thank you. Any help would be appreciated.

Running a browser game in Java

I would like to know how I would kind of like run a online browser game, like tetris, as a Java application so I could control it (like in tetris using the wasd or arrow keys to move blocks) from within the application I program for the game. Not sure if that makes sense but don't know how else to explain it. The purpose is to hook it up to an AI program that plays the game, but yeah I don't know how to allow the program to control the game using the games allowed inputs.
Java.awt.Robot seems to be what you need
It should be able to simulate any keyboard or mouse input, but if you need to do anything too complicated I would suggest something other than Java - it doesn't get too close to the operating system, so something like c++ may be more accurate.

Java - Screen Change Transitions

I have been working on a game and the code is some what solid. I have about 7 classes and it runs with no bugs but the graphics don't run smoothly. At the beginning of the game there is a start menu like almost every other game. The menu looks great but when I press the button the screen blinks white before the level comes on. I am using pure java with a simple Jframe and GamePanel. I also use very basic double buffering. The level image loads in a different class the the GamePanel one which contains the start screen image. I have looked into moving the level image into the GamePanel and nothing changed. Feel free to ask me any questions to go more in depth.
Thanks,
Dev

Java Robot key activity seems to stop working while certain software is running

I'm writing a Java application to automate character actions in an online game overnight (specifically, it catches fish in Final Fantasy XI). The app makes heavy use of java's Robot class both for emulating user keyboard input and for detecting color changes on certain parts of the screen. It also uses multithreading and a swing GUI.
The application seems to work perfectly when I test it without the game running, just using screenshots to trigger the apps responses into notepad. But for some reason, when I actually launch FFXI and start the program, all of my keyboard and mouse manipulations just stop working altogether. The program is still running, and the Robot class is still able to read pixel colors. But Robot.keyPress, Robot.keyRelease, Robot.mouseMove, Robot.mousePress and Robot.mouseRelease all do nothing. It's the strangest thing-- to test it, I wrote a simple loop that just keeps typing letters, and focused notepad. I'd then start the game, refocus notepad, and it would do nothing. Then I'd exit the game, and it'd start working again immediately.
Has anyone else come across something like this, where specific software will stop certain functions of java from working?
Also, to make this more interesting-- Last year I wrote a very similar program using the same classes and programming techniques to automate healing a party in the game as they fight. Last year, this program worked perfectly. After running into these problems I dug up that old program, ran it without making any changes, and found that it too was having the same problems. The only differences between now and when it was working: I was running Windows Vista and now I'm running Windows 7, and several new Java versions as well as FFXI versions have been released.
What the hell is going on? (if anyone needs to see my source code, email me at mikejturley#gmail.com. I'm trying to keep it to myself.)
FFXI has code to prevent cheating. Quite effectively, it would seem.
If possible, try it in WinXP. I myself have also written a bot for an online game that uses much of the same concepts (i.e. using Java Robot to read pixel colors and simulate key-presses and mouse-clicks).
Under WinXP:
Bot works as intended in all cases.
Under Win7:
Outside of the game, bot works as intended. Ingame, simulated input failed (pixel reads were okay, I think).

Categories

Resources