Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (491)
Games in Android Showcase (112)
games submitted by our members
Games in WIP (556)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Java Game APIs & Engines / Engines, Libraries and Tools / Tiled - Isometric Map Problem on: 2014-08-26 00:20:48
I'm not sure if this is the correct forum to post this, but it does say Engines, Libraries and Tools.

Let me get to the point, I am not sure what's wrong with me, but I simply cannot understand how do you place tiles in isometric tile maps using Tiled Editor. When I create a new map it asks me for map size and tile size. I know the tile size, so I enter the correct tile size, but still the rotation (if you want to call it like that) isn't good.

I would provide screenshot under image tags for forum, but I thought it was too large, so here's link: http://oi57.tinypic.com/ayrc4g.jpg
2  Game Development / Newbie & Debugging Questions / Re: [SOLVED] Collision Issue on TiledMap (Slick2D) on: 2012-12-22 14:07:21
Actually, my collision checking method was correct, but I used it in a wrong context, for the lack of a term. My new method of doing it is drawing rectangles on the blocked tile spots. Maps gets drawn on top of those rectangles, so they're not visible. It works like a charm!

Here's the code:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
   public boolean collides(float x, float y, Graphics g){
      Rectangle player = new Rectangle(x, y, 32, 32);
      g.draw(player);
      for(int i = 0; i < rects.size(); i++){
         if(player.intersects(rects.get(i))){
            System.out.printf("Collision detected at (%s, %s).\n", x, y);
            return true;
         }
      }
      System.out.printf("No collision has been detected.\n");
      return false;
   }


Thank you for your help, anyway!
3  Game Development / Newbie & Debugging Questions / [SOLVED] Collision Issue on TiledMap (Slick2D) on: 2012-12-21 06:53:00
Hello.
I've tried my best to make this collision work, but I simply can't. I tried every method, even copied the code from internet tutorial, but it simply won't work. It seems as if when the player is in the middle of two tiles, it won't work. Uh, I don't know how to explain it right, so I'll post some screenshots.

It works if the player is in a "full" tile.
Click here to see the screenshot.

But, if a player is kind of in a "half" tile, it doesn't.
Click here to see the screenshot.

The code I use to check for the collision:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
   public void update(int delta, int direction, Map map){
      speed = 0.2f; // Just for testing purposes. Will remove later.
     switch(direction){
         case 1: // Up
           sprite = up;
            if(!map.isBlocked(x, y - delta * speed)){
               y -= delta * speed;
            }
            break;
         case 2: // Down
           sprite = down;
            if(!map.isBlocked(x, y + Constants.TILE_SIZE + delta * speed)){
               y += delta * speed;
            }
            break;
         case 3: // Left
           sprite = left;
            if(!map.isBlocked(x - delta * speed, y)){
               x -= delta * speed;
            }
            break;
         case 4: // Right
           sprite = right;
            if(!map.isBlocked(x + Constants.TILE_SIZE + delta * speed, y)){
               x += delta * speed;
            }
            break;
         default:
            System.err.println("Invalid direction.");
            break;
      }
   }


My isBlocked(float, float) method (in Map class) is pretty simple:
1  
2  
3  
4  
5  
   public boolean isBlocked(float x, float y){
      int xTile = (int) (x / 32);
      int yTile = (int) (y / 32);
      return blocked[xTile][yTile];
   }


NOTE: In my map class I set up stuff with TiledMap, just so you know.
4  Games Center / Showcase / Re: Plague on: 2012-09-29 17:57:31
Doesn't seem to work for me. Gets stuck on the "Plague is Loading" screen and then it turns grey. Command line shows
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
java.io.IOException: mark/reset not supported
        at java.util.zip.InflaterInputStream.reset(Unknown Source)
        at java.io.FilterInputStream.reset(Unknown Source)
        at com.sun.media.sound.SoftMidiAudioFileReader.getAudioInputStream(Unkno
wn Source)
        at javax.sound.sampled.AudioSystem.getAudioInputStream(Unknown Source)
        at sothatsit.plague.Sounds.load(Sounds.java:23)
        at sothatsit.plague.Plague.start(Plague.java:162)
        at sothatsit.plague.Plague.main(Plague.java:120)
java.io.IOException: mark/reset not supported
        at java.util.zip.InflaterInputStream.reset(Unknown Source)
        at java.io.FilterInputStream.reset(Unknown Source)
        at com.sun.media.sound.SoftMidiAudioFileReader.getAudioInputStream(Unkno
wn Source)
        at javax.sound.sampled.AudioSystem.getAudioInputStream(Unknown Source)
        at sothatsit.plague.Sounds.load(Sounds.java:35)
        at sothatsit.plague.Plague.start(Plague.java:162)
        at sothatsit.plague.Plague.main(Plague.java:120)
java.io.IOException: mark/reset not supported
        at java.util.zip.InflaterInputStream.reset(Unknown Source)
        at java.io.FilterInputStream.reset(Unknown Source)
        at com.sun.media.sound.SoftMidiAudioFileReader.getAudioInputStream(Unkno
wn Source)
        at javax.sound.sampled.AudioSystem.getAudioInputStream(Unknown Source)
        at sothatsit.plague.Sounds.load(Sounds.java:47)
        at sothatsit.plague.Plague.start(Plague.java:162)
        at sothatsit.plague.Plague.main(Plague.java:120)
Exception in thread "Thread-5" java.lang.NullPointerException
        at sothatsit.plague.Sounds.setSoundVolume(Sounds.java:72)
        at sothatsit.plague.Plague.init(Plague.java:288)
        at sothatsit.plague.Plague.run(Plague.java:296)
        at java.lang.Thread.run(Unknown Source)

5  Game Development / Newbie & Debugging Questions / Re: Tiled Map Level Editor Problem on: 2012-09-28 21:23:13
Thank you so much!
Added appreciation.
6  Game Development / Newbie & Debugging Questions / Re: Tiled Map Level Editor Problem on: 2012-09-28 20:44:57
I've wrapped JFrame in JScrollPane, but it's same.

Here is the code snippet, I might be doing something wrong.
1  
2  
3  
4  
5  
   public static void main(String[] args){
      Start start = new Start();
      JScrollPane pane = new JScrollPane(new Editor(start), ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_ALWAYS);
      start.add(pane);
   }

Here is constructor of Start class:
1  
2  
3  
4  
5  
6  
7  
   public Start(){
      setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      setSize(800, 600);
      setLocationRelativeTo(null);
      setVisible(true);
      setResizable(false);
   }
7  Game Development / Newbie & Debugging Questions / [SOLVED] Tiled Map Level Editor Problem on: 2012-09-28 07:27:54
Hello, JGO community.

I've been looking for solution a whole day yesterday, but found none. Basically I have window which is 800x600 and my tiled map is 30x30 (each tile is 32x32). I want to be able to scroll through my map using JScrollPane. I've looked in this thread, but Mr_Light's solution doesn't work for me. I've wrapped the JPanel in the JScrollPane, and I also forced those slide bars to always be visible, but I can do nothing with them.

Here is the screenshot of level editor's JPanel:

[size=7pt]NOTE: Tiles were drawn by me, so please don't steal them.[/size]

Thank you, in advance, to anyone who tries to help me!
8  Games Center / WIP games, tools & toy projects / Re: [First Game] Levels [1.2] on: 2012-09-25 19:33:00
Last time I played this game, there weren't those teleporting circles and menu. It's even better now. I like where this is going.

By the way, Bucky Roberts. Tongue
9  Game Development / Newbie & Debugging Questions / Re: Warning Question on: 2012-09-22 14:15:03
Also, why do you pass the name on to init? Why not just set the name in the constructor? It's not likely that you want your program to change its name in the middle of execution anyway. The other calls are sitting fine in the init, though.
Program's name is stored 'n' set in other class named Frame. That was JPanel's name. For some reason I want to set the name of JPanel. Tongue

Thank you all for showing the interest to help me.
I will most likely break my habbit and leave the warning
there, but I'm not sure yet. Once again, thanks.
10  Game Development / Newbie & Debugging Questions / Warning Question on: 2012-09-22 09:42:13
Hello, JGO community.

When I write (Java) applications, I really don't like having any warnings.
Right now, I am working on a simple Breakout game and I decided to use
Netbeans. Basically, I have a code that in  Netbeans shows a warning,
while in Eclipse it doesn't. I am wondering why. Here is the code:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
package game;

import java.awt.Color;
import javax.swing.JPanel;

public class Board extends JPanel{
    public Board(String name){
        init(name);
    }
 
    public void init(String name){
        setName(name);
        setBackground(Color.WHITE);
        setFocusable(true);
    }
}


In NetBeans, there is the warning on this line:
1  
init(name); // WARNING: Overridable method call in constructor.


I understand that this is highly irrelevant, but I just want to know how
can I fix that warning without suppressing the warnings for the constructor.
Pages: [1]
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

Nickropheliac (15 views)
2014-08-31 22:59:12

TehJavaDev (23 views)
2014-08-28 18:26:30

CopyableCougar4 (33 views)
2014-08-22 19:31:30

atombrot (41 views)
2014-08-19 09:29:53

Tekkerue (40 views)
2014-08-16 06:45:27

Tekkerue (35 views)
2014-08-16 06:22:17

Tekkerue (25 views)
2014-08-16 06:20:21

Tekkerue (37 views)
2014-08-16 06:12:11

Rayexar (72 views)
2014-08-11 02:49:23

BurntPizza (49 views)
2014-08-09 21:09:32
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!