slick2d

How do I work with “delta” in Slick2D/LWJGL or game programming in general?

本秂侑毒 提交于 2019-12-20 04:30:10
问题 All I know is that delta relates somehow to adapting to different frame rates, but I'm not sure exactly what it stands for and how to use it in the math that calculates speeds and what not. Where is delta declared? initialized? How is it used? How are its values (min,max) set? 回答1: It's the number of milliseconds between frames. Rather than trying to build your game on a fixed number of milliseconds between frames, you want to alter your game to move/update/adjust each element/sprite/AI based

Slick2D and JBox2D. How to draw

谁说胖子不能爱 提交于 2019-12-17 10:24:18
问题 Before asking this i did A LOT of searching on the net. I just can't do it. It's a little hard for me to understand. So how do i draw the images at the right screen positions coresponding to bodies in world position? Thanx. If anyone else finds himslef in front of the same obstacle i posted a HOW TO, thanx to normalocity's good explanation. You can find it here: http://romeo.akademx.ro/2012/04/06/slick-and-box2d/ This is the render function: public void render(GameContainer container,

Slick2D GUI Button listener

血红的双手。 提交于 2019-12-14 03:12:09
问题 I'm trying to make button in slick by extending AbstractComponent: public class StandardButton extends AbstractComponent { protected int x; protected int y; protected int Width; protected int Height; protected String Text; public StandardButton(GUIContext container,int x, int y, String Text, int Width, int Height,ComponentListener listener) { super(container); this.Text=Text; setLocation(x, y); this.Width=Width; this.Height=Height; addListener(listener); } @Override public void render

Slick Animation - There must be one duration per frame

只谈情不闲聊 提交于 2019-12-13 14:04:54
问题 I am trying to make a game in Slick, and before I start I want to test the helicopter animation I will be using. It just opens and then immediately closes with these errors: Exception in thread "main" java.lang.RuntimeException: There must be one duration per frame at org.newdawn.slick.Animation.(Animation.java:111) at javagame.Menu.init(Menu.java:22) at javagame.Game.initStatesList(Game.java:19) at org.newdawn.slick.state.StateBasedGame.init(StateBasedGame.java:170) at org.newdawn.slick

Why Aren't My Tile Maps Displaying Correctly?

荒凉一梦 提交于 2019-12-13 04:38:43
问题 I am trying to load and render levels (tile maps) in Slick2D from text files. The text files look something like this: res/RPGSheet 32x32.png (tileset to be used with this map) 5 (How many tiles wide the map is) 5 (How many tiles tall the map is) 16 (How many tiles wide the tileset is) 16 (How many tiles tall the tileset is) 4,1 4,1 4,1 4,1 4,1 4,1 1,1 2,0 4,1 4,1 4,1 4,1 1,1 4,1 4,1 4,1 1,1 4,1 1,1 4,1 4,1 4,1 4,1 4,1 4,1 First I'll explain how my tilemaps work: Each coordinate indicates

Slick2D + Tiled cant load map

半城伤御伤魂 提交于 2019-12-13 00:15:16
问题 I couldn't find problem like this anywhere. I have such results: Wed Jun 26 09:30:02 CEST 2013 INFO:Slick Build #237 Wed Jun 26 09:30:02 CEST 2013 INFO:LWJGL Version: 2.9.0 Wed Jun 26 09:30:02 CEST 2013 INFO:OriginalDisplayMode: 1366 x 768 x 32 @60Hz Wed Jun 26 09:30:02 CEST 2013 INFO:TargetDisplayMode: 640 x 480 x 0 @0Hz Wed Jun 26 09:30:02 CEST 2013 INFO:Starting display 640x480 Wed Jun 26 09:30:02 CEST 2013 INFO:Use Java PNG Loader = true WARNING: Found unknown Windows version: Windows 7

Make the player go towards the mouse - Slick & Java

柔情痞子 提交于 2019-12-12 04:57:26
问题 So here is my problem: I'm a (new) java programmer and I need help for the game I am developing with Slick and LWJGL. What I want to do is really simple: make the player (or the image representing the player) head towards the mouse once I hold down the mouse button. I don't want it to rotate towards the player. Here's what my "Play" class looks like: package com.stuntmania.game; import org.lwjgl.input.Mouse; import org.newdawn.slick.Animation; import org.newdawn.slick.Color; import org

Java - how to use the vertex buffers object in LWJGL?

≯℡__Kan透↙ 提交于 2019-12-12 04:34:55
问题 I am trying to use the vertex buffers object. At first there wasn't any problem until I got into this nasty situation: glPointSize(2.0f); glBegin(GL_POINTS); for (Entity p : points) { glVertex3f(p.x, p.y, p.z); } glEnd(); How can I convert this into the Vertex Buffers Object render? I mean as you can see, the data (x, y, z) are changed every time for each point (it's a loop ). So how can i implement the Vertex Buffers Object render into this? 回答1: Basically what you want it putting all the

Putting Java Slick game on a website using html

喜你入骨 提交于 2019-12-12 03:46:56
问题 I have made a 2D java game using Slick and it extends StateBasedGame, it does not extend JApplet so it is not really a real application but from the link bellow it shows that StateBasedGame is part of the Slick API and it can be used as an applet if the html code is coded correctly, here is the link: http://ninjacave.com/slickapplet I tried modifying it to fit my code and came up with the following: <applet code="org.lwjgl.util.applet.AppletLoader" archive="lwjgl_util_applet.jar" codebase="."

Can't use LWJGL correctly, code giving errors

与世无争的帅哥 提交于 2019-12-12 02:55:22
问题 I'm trying to run this code that is used to see if things were setup properly: package simpleslickgame; import java.util.logging.Level; import java.util.logging.Logger; import org.newdawn.slick.AppGameContainer; import org.newdawn.slick.BasicGame; import org.newdawn.slick.GameContainer; import org.newdawn.slick.Graphics; import org.newdawn.slick.SlickException; public class SimpleSlickGame extends BasicGame { public SimpleSlickGame(String gamename) { super(gamename); } @Override public void