Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (494)
Games in Android Showcase (114)
games submitted by our members
Games in WIP (563)
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  Game Development / Newbie & Debugging Questions / Merge an image file and a text file into one file on: 2012-09-05 15:56:20
Hey guys!

Being a noob, I'm currently experiencing around with Slick and I'm trying to make little games.

I load sprite sheets and then read their properties (to construct collision shapes) from text files.
Those files contains only one line, which looks like this: <name>; <type>; <bunch of integer values>.

I was wondering if I could combine the (regular) text file with the (png) image file into one file?

The new file would look like this: the first x bytes are reserved for the text data, followed by the image data. The read method would separate it when reading the file.

I'd like to make some reusable classes (mini engine?), so please forgive me if its a silly idea.  Roll Eyes
2  Game Development / Newbie & Debugging Questions / Re: java.awt.Shape and mouse event on: 2012-02-29 19:43:23
Are those circles evenly divided?
Kind of. I'm working on a Mill/Mills/Merels game.


link: http://noob.hu/2012/02/29/Merels_0.png

I'm sorry if I was unclear. I'd like those circles (shapes) to act like, lets say a JToggleButton which has 3 states based on mouse interact (idle, mouse over and pressed). Despite the fact that I have only 24 circles here, I'd like to work out a solution which can be applied to more of them, without the need of looping through an array/list with hundreds of elements every time. A circle is defined as a class.

I'm kind of new to game developement (as you might have noticed Tongue), I do not know things in concepts, that is why I wrote every time that I don't like the solution.
3  Game Development / Newbie & Debugging Questions / Re: java.awt.Shape and mouse event on: 2012-02-29 16:22:04
No, I just don't like it, and I couldn't make any better.

Imagine a GUI with some buttons on it, where you would like to check if the user clicks on any of them (or highlight them if the cursor hovers over them). Would you do it this way? Just doesn't seems right.  Huh
4  Game Development / Newbie & Debugging Questions / Re: java.awt.Shape and mouse event on: 2012-02-29 15:31:17
Thanks guys!

Seems like I got to stay with that solution.

If I do this brute-force check every time, should I divide the panel into smaller rectangles, like 3 600*200 pieces, check the cursor position against them first and then do the check on the circles that are in those pieces? Or it would be pointless?
5  Game Development / Newbie & Debugging Questions / Re: java.awt.Shape and mouse event on: 2012-02-28 12:10:14
Thank you for your answer!

The solution you mentioned is exactly the same what I did, but I didn't really liked it. For example if I have 200 circles I have to loop through them in every game loop, which doesn't seems like a correct solution for me. I was thinking about something like MouseListener's mouseEntered() method used on a JPanel where the cursor's location triggers the event by hovering over the panel, but I could't make it work as I wanted.

Any advice on it?
6  Game Development / Newbie & Debugging Questions / java.awt.Shape and mouse event on: 2012-02-27 20:00:55
Hey guys!

I've got a little problem and I'd like to seek your advice on it. I have a few circles (Ellipse2D.Float) drawn to a JPanel. Those circles should change their size/color when the mouse hovers over them or the player clicks on them, but I can not figure out how to implement it.

All the circles have their fixed location while the panel's dimension is also fixed at 600*600.

I've tried two things so far, my first idea was to use MouseInfo's getPointerInfo() to check if any circle contains the current location of the cursor, but I don't really like that solution. I also tried to create a custom event, but I had never done it before and I couldn't make it to work.

How would you implement it?

Thank you in advance!
zilik
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.

Dwinin (21 views)
2014-09-12 09:08:26

Norakomi (55 views)
2014-09-10 13:57:51

TehJavaDev (66 views)
2014-09-10 06:39:09

Tekkerue (33 views)
2014-09-09 02:24:56

mitcheeb (54 views)
2014-09-08 06:06:29

BurntPizza (38 views)
2014-09-07 01:13:42

Longarmx (24 views)
2014-09-07 01:12:14

Longarmx (30 views)
2014-09-07 01:11:22

Longarmx (28 views)
2014-09-07 01:10:19

mitcheeb (36 views)
2014-09-04 23:08:59
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!