slick2d

Loading Tile Maps From Text Files In Slick2D

柔情痞子 提交于 2019-12-12 01:04:42
问题 I am making a fairly simple 2D Game Engine in Java using the Slick2D Library, and am trying to load levels (tile maps) from a text file. I want to be able to load in multiple different tilesets, and therefore don't want to assign each number to a tile like this: 1 1 1 1 1 1 0 0 0 1 1 0 0 0 1 1 0 0 0 1 1 1 1 1 1 (Where 1 is a wall and 0 is a floor) instead, I would like to be able to use x and y coordinates in the tilemap to represent how many tiles across and down the tile is located at on

Stop sprite from ghosting through another sprite

北城以北 提交于 2019-12-11 17:59:10
问题 Ok so I've just started learning java (I usually program in Objective-C). My first game is a game similar to Pokémon, however, its a lot more simplified obviously... The trouble I'm having is I can't find a way to stop 2 sprites from 'ghosting' through each other. On screen I have borders set up (boundaries), A player sprite, and an Enemy sprite. public void playerUpdate(GameContainer gc, int delta) throws SlickException { Input input = gc.getInput(); // Right Key Pressed if (input.isKeyDown

How to make slick2d resizable

那年仲夏 提交于 2019-12-11 16:29:23
问题 Hey guys I was wondering if there was a way to make slick2d resizable by the user.(I have researched this and only found out how to make the program resizable within the program) Here is my code and thanks in advance. package Main; import States.Menu; import States.Play; import org.newdawn.slick.*; import org.newdawn.slick.state.*; /** * * @author Kyle */ public class Lawu extends StateBasedGame{ public static final String gamename = "Lawu"; public static final int menu = 0; public static

Slick2D Methods are missing

寵の児 提交于 2019-12-11 16:09:12
问题 I am using Slick2D to code a little game, and after a lot of time that already went into it, I changed my mind and decided that I indeed want the game to be resizable. So I tried to use the app.setResizable() command, as suggested on the Slick2D wiki (and here: How to make slick2d resizable). But my eclipse just didnt find that method, so I looked it up on the Internet again, and noticed that all attributes and methods reliative to resizing are missing (such as wasResized(), isResized(),

Getting an instance of a subclass from a different class

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 14:14:33
问题 I am writing a game using the slick 2D engine and my own entity engine to work out the details of a 2D side scroller The way my code currently works is like this: Entity class holds entity information. It can have an Ability, something like Animation or sound or movement. All abilities are subclasses of an abstract class called Ability. I have a method in the Entity class where I wish to get an instance of a specific ability, so that I can use its methods: public Ability getAbility(String id)

Multiple Rectangle Generation [duplicate]

这一生的挚爱 提交于 2019-12-11 09:36:46
问题 This question already has an answer here : Closed 7 years ago . Possible Duplicate: Drawing multiple pixels/rectangles In my code i wrote a method that creates a rectangle at mouseX, mouseY. but all it does is update the position of that rectangle so it follows the mouse, i want it to create a new one at the mouse every time the method runs, can someone please help? this is my method public void drawParticle(float x, float y){ g.drawRect(x, y, 4, 4); } The main class Control call the

Putting my Java Slick game onto a website

不问归期 提交于 2019-12-11 01:45:48
问题 I have made a GUI in Java using State Based Game, as it extends StateBasedGame and not JApplet its not a true applet, I want to put it on a website and am unsure on how to do this, I have been told that the following code allows me to make this into an applet using html and not having to edit the Java code: <applet code="org.lwjgl.util.applet.AppletLoader" archive="org.lwjgl.util.applet.AppletLoader" codebase="." width="640" height="480"> <param name="al_title" value="Ham Blaster"> <param

How To Encrypt Resource Files?

假如想象 提交于 2019-12-10 18:54:38
问题 Hi I have a game made in Java and Slick2d and I have a folder that contains all of my resources (images, sounds, etc) and I was wondering how to encrypt them so people can't edit them? I tried MD5 but I'm not really sure how it works and I'm not worried about people breaking into the code because I have spliced the jar into an exe file. Also if I need to know how to decrypt the files so that they can be used in the code please explain that too. 回答1: There is no way to protect the images

“Could not find main method from given launch configuration” when using Java+Scala+Slick2D

折月煮酒 提交于 2019-12-09 02:57:52
问题 I've got a project in which I'm using Java+Scala+Slick2D. The project itself runs well when launched from within eclipse. But when I try to make a jar file, it just refuses to work. Here's the error I keep getting when trying to export it as a Runnable jar: And if I try to export into just a Jar file, it's unable to find the Main Class: There is, of course, a main class in game.TicTacGame. But it refuses to acknowledge it. I tried creating an executable with a simple Hello World project and

Can i change things while debug mode is running in Eclipse?

半世苍凉 提交于 2019-12-08 04:53:10
问题 so as the title states, can i change things while debug mode is running an application in Eclipse? You know like colors or stuff like that, I've seen Notch (Creator of Minecraft) do this thing when he was making "Escape" in 48 hours. I think that if I can do that then is more easy for me to change things like, moving buttons in the main menu, changing backgrounds or at least text colors. PS: I'm using Slick2D Thanks and have a nice day. 回答1: If I understand your question correctly, you can do