Tagged Questions
-3
votes
1answer
75 views
2D Game Engines [closed]
I'm a computer science student and I recent completed a module based on the development of 2D and 3D games.
I want to develop a 2D game in java as a personal project, the library we worked with ...
-2
votes
1answer
82 views
Slick game adding enemies towards the player [closed]
I'm beginner in java games, and this is my first time using Slick!
I followed the thenewboston tutorials to code my game.
My game is about a princess lost in a maze, on her way she finds bugs coming ...
3
votes
0answers
101 views
Dynamic “Light Level” System based on alpha levels
My team and I have been working on a game in Java using the Slick2D engine and there are a few things I have questions on. As of right now, the code that I've written basically takes a cosine function ...
3
votes
3answers
106 views
How do I undo changing the color of an image in Slick2d?
This code colors the enemy red:
enemies.get(i).image.setColor(0,1,0,0,1);
enemies.get(i).image.setColor(1,1,0,0,1);
enemies.get(i).image.setColor(2,1,0,0,1);
enemies.get(i).image.setColor(3,1,0,0,1);
...
0
votes
0answers
69 views
Why does Slick import Tiled object rectangles without width, height, and name tags?
I tried using Tiled rectangle objects as walls with Slick's TiledMapPlus class, but as I soon realized that each GroupObject would return 0 for width and height. The code I used looks like this:
...
1
vote
2answers
80 views
Inputting Only Alphabetical Input - Slick2D
I'm trying to obtain the user input for when they enter their own name. However I would prefer to have it Alphabetically.
This is what I'm doing at the moment:
if (input.isKeyDown(Input.KEY_A)) ...
0
votes
1answer
60 views
How do I pass textures into a fragment shader in Slick?
I've written a shader that uses three different textures, tex0, tex1, and tex2. I can load it into Slick and successfully display it, but I can't figure out how to set the three different textures. ...
1
vote
4answers
267 views
Limiting a player's movement to the screen's dimensions
I have a player, that I can control using WASD. And I don't want him to leave the screen.
So I've tried the following:
if (player1.getX()+5 < 974 && player1.getX()-5 > 0) {
...
0
votes
0answers
136 views
Slick 2D jar creation
I recently finished making my game using Slick2D, and now I'm trying to create a jar file to play the game. I looked on the Slick forums, and saw that JarSplice was the recommended program. So I used ...
5
votes
4answers
656 views
Should each Entity have its own update and render methods?
First, the questions:
Should each Entity (which are classes like Character, Tree, Enemy) have its own update() and render() methods?
If that's the case, then should I use Interfaces like ...
0
votes
0answers
805 views
Issues playing audio with Slick 2D [closed]
Started trying to learn Slick 2D a few days ago and have enjoyed it so far. The only problem is I can't seem to be able to get audio to play. I have tried going through the documentation examples, ...
-1
votes
1answer
75 views
Why are only some of my objects being rendered?
Every time I create a new asteroid the previous one is no longer rendered?
I did some debugging and printed out the size of Array-List 'Small' and when a new asteroid is created it doesn't go down, ...
1
vote
1answer
122 views
Putting a Java/Slick game on your website?
I've made a simple little 2D game in Java using Slick and I want to embed it in my website. I'm just a little confused as to how to go about it, I'm guessing I need to export it as a WAR file?
Sorry ...
0
votes
0answers
95 views
How do I separate codes with classes? [closed]
I have this main class:
package javagame;
import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.SlickException;
import ...
3
votes
1answer
213 views
How can I set the rotation of a shape to the same as my image?
The way you set rotations of images is different from setting shape rotations.
So how can I make the shape have the same rotation as my image?
This is how my image rotates:
...
1
vote
1answer
178 views
Fixing a collision detection bug in Slick2D
My game has a bug with collision detection.
If you go against the wall and tap forward/back sometimes the game thinks the speed you travelled at is 0 and the game doesn't know how to get you out of ...
2
votes
1answer
108 views
How to decide face side of sprite
I am just starting game-dev with slick2D and marte engine. When I move my sprite left and right, I am doing walk animation but when the key is released how can I decide in which side the sprite face ...
3
votes
2answers
387 views
How do you set the movement speed of a sprite?
I'm using Slick 2D/Java to play around with graphics. Getting an image to move is easy:
Input input = gc.getInput();
if(input.isKeyDown(sprite.up)){
sprite.y--;
}else if ...
4
votes
4answers
392 views
Can a high FPS negatively affect how a program runs?
Yeah I know this is a broad question and will get down rated, I'm just hoping for some answer before it gets closed.
Anyway, I'm using Slick 2D/Java to play around with graphics. I'm having some ...
-5
votes
1answer
65 views
Help, i cant reference my vars! [closed]
I have a sub-class(let's call it sub) and it contains all the function of an object in my game. In my main class(Let's call it main), i connect my sub to main. (Example sub
Code:
s = new sub();
...
-3
votes
1answer
91 views
How to reference or connect a variable to another class without stack overflow? [closed]
I really need to re-arrange all my functions. I created a class. All my var, booleans, int, doubles and other things. I created every new variable so they can reference it and so they don't have an ...
-6
votes
1answer
102 views
Is it the class that slows down the game? [closed]
My framerate lastime exceeds 1000 now the highest is 15. I have thousands lines of code in one class(I was still fresh last time and did not think of putting it in another class) Is it the class that ...
-3
votes
1answer
74 views
Why does my text is shown below an image? [closed]
My text is below an Image but my other text is above the image. I can't find out why. It just have an if statement.
if(renderText==false)
{
g.drawString("heelo", 300, 600);
}
Even ...
-2
votes
1answer
396 views
How do I make time?
I wanted to output a text for a certain amount of time. One way is to use threads. Are there any other ways? I can't use threads for slick2d. This is my code when I use threads for slick:
package ...
0
votes
1answer
173 views
MarteEngine Tile Collision [closed]
I need to add collision to my tile map using MarteEngine. MarteEngine is built of of slick2D. Here's my tile generation code:
Code:
public void render(GameContainer gc, StateBasedGame game, Graphics ...
-6
votes
1answer
331 views
How to remove the FPS text on slick2d?
How do I remove the frame rate text on the upper left corner?
1
vote
1answer
559 views
Java 2D Tile Collision
I have been working on a way to do collision detection forever, and just can't figure it out. Here's my simple 2D array:
for (int x = 0; x < 16; x++) {
for (int y = 0; y < 16; y++) {
...
1
vote
1answer
223 views
How to I get a rotated sprite to move left or right?
Using Java/Slick 2D, I'm using the mouse to rotate a sprite on the screen and the directional keys (in this case, WASD) to move the spite. Forwards and backwards is easy, just position += ...
-5
votes
2answers
142 views
How to stop reducing life? [closed]
CODE
Input input = gc.getInput();
int xpos = Mouse.getX();
int ypos = Mouse.getY();
emu = "Enemy Life : " + enemyLife;
Life = "Your Life Is" + life;
...
1
vote
1answer
139 views
how do I add development build number each time I compile and play?
I wanted each time I play my game, it will show in the console how many times you compiled or run the game. How do I do that?
0
votes
2answers
606 views
How do I create a Loading Scene in SLick?
I actually wanted just a fake loading scene. For a fake loading scene, how do I make a time variable or a time Method? I'm still a fresh java programmer!
0
votes
2answers
334 views
Can't get sprite to rotate correctly? [closed]
I'm attempting to play with graphics using Java/Slick 2d. I'm trying to get my sprite to rotate to wherever the mouse is on the screen and then move accordingly. I figured the best way to do this was ...
-2
votes
2answers
90 views
How to use outside int to be used in my class? [closed]
I wanted my character's life to be the same as the other game state. My other game state is different the from my original state. I wanted to link my int to my new game state to make it the same. How ...
-2
votes
1answer
147 views
Why do I have an error when adding states in slick? [closed]
When I was going to create another state I had an error.
This is my code:
public static final int play2 = 3;
and
public Game(String gamename){
this.addState(new mission(play2));
}
...
4
votes
2answers
2k views
Move sprite in the direction it is facing?
I'm using Java/Slick 2D. I'm trying to use the mouse to rotate the sprite and the arrow keys to move the sprite. I can get the sprite to rotate no problem, but I cannot get it to move in the direction ...
-1
votes
1answer
307 views
Resource not found?
When I write in my terminal, java -jar myJar.jar, it gives me an error "Resource Not found res/playNow.png" When I run it in eclipse, it does not give me any errors about this image.
My folder in my ...
0
votes
2answers
122 views
Unable to access jar. Why?
I was making a game in java and exported it as jar file. Then after that, I opeed jar splice. I added the libaries and exported jar. I added the natives then i made a main class. I created a fat jar ...
-1
votes
1answer
231 views
How to make an Image still when at position at Slick 2D?
I wanted to have a build functions. When I press for example 2, the image will appear with my character.
The question is, how do I stop it from following my character
//build
//I created many ...
1
vote
1answer
426 views
How do I make my Slick2D game fullscreen?
How do I make my game fullscreen? It's always in windowed mode. I'm using Eclipse on a Mac.
-2
votes
2answers
118 views
How do I add Destroy with radius on Java Slick2d? [closed]
For Example, There is a tree(image) and i want to destroy it. I want my character only destroy it (For example the character must be facing the tree to destroy it and there must be a range were you ...
1
vote
2answers
886 views
Creating maps and tileset for a 2d java game
I'm not a completly beginner to java, so I decided to write a map loader and a tileset loader myself instead of using a tilemap editor like Tiled. I'm using Slick & LWJGL for my game.
The plan ...
1
vote
1answer
75 views
Variable Visibility Class Interaction
I have a very general question about how game classes interact with eachother in a growing RPG game project I'm working on. (Writing it in java/Slick2D, not that is matters because the question is ...
0
votes
1answer
95 views
Menu selection wont stay on selected option
My Menu has a START and a QUIT option. I'm using a controller's D-PAD for selection. The game begins with START highlighted. When I push the down button on the D-PAD, it highlights the QUIT option. ...
0
votes
3answers
535 views
How do you make bullets move at an angle in different angles using delta
I'm having trouble making my bullets move at a steady pace using delta. I have the formula I used outside of slick2d, but it doesn't take delta into account. My bullets fly fast. How do I make them go ...
1
vote
3answers
797 views
How to efficiently manage animations and/or textures (resources) in a game?
I am using Java, particularly the Slick2D library. Seeing as this is my first game, I have no idea how I should manage the Animations and the textures in the game in a way to be both memory efficient ...
2
votes
1answer
783 views
How can I accomplish Pokemon-style movement over tiles in java?
I'm talking about where if you press a directional key once you walk over to the adjacent tile and can't do any other actions during the walk. I can get my character to move one tile width, but my ...
1
vote
1answer
151 views
Invert colors Java rendering
I am making a 2d platformer in java using the slick2d engine. I only use 2 colors: black and white. I want to implement a feature were i invert the colors of certain entities. However i can't find a ...
1
vote
1answer
815 views
Vector movement in space type game (Mouse rotation)
I'm having an issue with my movement in my 'game' prototype. It's basically not working and admittedly my knowledge with vectors is lacking.
The issue I'm running into is that the ship won't move in ...
2
votes
3answers
139 views
Positioning entities in adjacent maps
Say I have a 2D tile based game engine (I don't, but I will soon). I was wondering how I would manage drawing adjacent maps. That is, imagine we have a map that is 50 by 50 tiles wide. Then next to ...
4
votes
2answers
785 views
How to get smooth transition within slick?
When a player clicks start, my app immediately switches to the first level. My question is how do I incorporate a smooth transition within Slick?

