Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (522)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (589)
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 / Game Mechanics / Re: The 0,1 & 2 conundrum! on: 2013-10-09 19:01:29
how about passing the index as an enum instead of an int. Something like this (I haven't checked to make sure the syntax is correct)

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
public enum Edge {
    ZERO( 0, ONE, TWO ), ONE( 1, ZERO, TWO ), TWO( 2, ZERO, ONE );

    Edge( int i, Edge op1, Edge op2 ) {
        index = i;
        output1 = op1;
        output2 = op2;
    }

    public final int index;
    public final Edge output1;
    public final Edge output2;
}

and then using it would look something like this
1  
2  
3  
4  
5  
6  
Edge ip; //input edge passed in

...

ip.output1.index //check edge output1
ip.output2.index //check edge output 2


I guess it's a bit more verbose than using (x+1)%3 and I have no idea about efficiency but that's another way you can do things.
2  Game Development / Newbie & Debugging Questions / Re: LWJGL Timing problem on: 2013-02-19 16:37:47
oh, my apologies. Other than wrongly assuming meaning based on your naming conventions, I don't see what's inherently wrong with your timing. Unless you're playing with the value of your delta in your update method or are somehow doing weird extrapolation in your render method, I honestly am not sure why that bug is happening for you.
3  Game Development / Newbie & Debugging Questions / Re: LWJGL Timing problem on: 2013-02-19 16:02:47
1  
speed = (forwardSpeed * GameLoop.delta) / 1000f;


if you want the speed to be constant, than you shouldn't be multiplying it's value like that. Regardless of how much time goes by, the speed shouldn't change in your case. The position does. Which brings me to my next point, that speed*time = distance, not speed again. so if you replace the speed there with your position variable like so,

1  
position += (forwardSpeed * GameLoop.delta) / 1000f;

you would get your proper position even if your delta fluctuates from lag.

4  Discussions / Miscellaneous Topics / Re: java-gaming.org blocked in Google? on: 2013-02-18 22:18:38
I typed in java game loop and this site came up on the last entry of the first page

so it's still there, just that google has given this site a lower priority I guess
5  Discussions / Miscellaneous Topics / Re: Things you disagree with in the java language on: 2012-09-16 07:01:57
thanks everyone for explaining this for me. I appreciate it as I try to get better.
6  Discussions / Miscellaneous Topics / Re: Things you disagree with in the java language on: 2012-09-15 04:19:37
I guess I'm kinda new to programming to be asking this but wouldn't a class which has no methods and only data fields be the same functionality-wise as a struct? or am I missing something that java does with classes that just isn't what you want from a struct Huh
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.

xFryIx (62 views)
2014-11-13 12:34:49

digdugdiggy (41 views)
2014-11-12 21:11:50

digdugdiggy (36 views)
2014-11-12 21:10:15

digdugdiggy (30 views)
2014-11-12 21:09:33

kovacsa (53 views)
2014-11-07 19:57:14

TehJavaDev (56 views)
2014-11-03 22:04:50

BurntPizza (55 views)
2014-11-03 18:54:52

moogie (70 views)
2014-11-03 06:22:04

CopyableCougar4 (71 views)
2014-11-01 23:36:41

DarkCart (156 views)
2014-11-01 14:51:03
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

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
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!