Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (540)
Games in Android Showcase (133)
games submitted by our members
Games in WIP (603)
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] 2 3 ... 14
1  Game Development / Newbie & Debugging Questions / Re: [JOGL] Unable to Draw a Square on: 2014-10-16 18:09:49
Did you try to change the glClearColor? That should 'ensure' that you have setup JOGL rendering correctly.

Also, I would check if color.getRed() for examples returns float and not an int, because
1  
2  
3  
125 / 255  = 0 
and
125.f / 255 = 0.5f


Ahh... Yep, that fixed the issue with the color. I do have one issue left now. All of the particles being rendered are absolutely massive. They take up most of the screen in quick flashes.

I think I remember something about using views when using OpenGL. Could it be that the view is just super zoomed-in?
2  Game Development / Newbie & Debugging Questions / [JOGL] Unable to Draw a Square on: 2014-10-16 17:47:16
Hey,

I'm trying to learn how to use JOGL and it's been going pretty-well so-far. I've modified most of the core code of a particle system to use JOGL to do all of the rendering.

The only problem I have now is getting something to actually render to the screen. The first piece of code below is the Driver class that I've hacked together. From all of the example I've seen, it should work. Although it's entirely possible that I've messed something up.
The second piece of code is the render method used on all particles. The render() method call in the display() method of the Driver class below ends up calling the render methods of all of the particles.

The only changes made to the program were to the Driver class, the render() method of the Particle class, and to the few render() methods that just pass along variables until the render() methods of the particles are called.

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  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
package core;

import com.jogamp.opengl.util.Animator;
import effect.Effect;
import effect.RainbowSnow;

import javax.media.opengl.*;
import javax.media.opengl.awt.GLCanvas;
import java.awt.*;

public class Driver implements GLEventListener {
    // Testing Stuff:
    private static Effect[] effect = new Effect[1];
    // End Testing Stuff.

   public static void main(String[] args) {
        GLProfile.initSingleton();
        GLProfile glp = GLProfile.get(GLProfile.GL2);
        GLCapabilities caps = new GLCapabilities(glp);

        // Create the frame.
        Frame frame = new Frame();
        frame.setTitle("Particle Test");
        frame.setExtendedState(Frame.MAXIMIZED_BOTH);
        frame.setUndecorated(true);
        frame.setResizable(false);
        frame.setLocationRelativeTo(null);
        frame.requestFocus();

        /*
        // Create the screen.
        Screen screen = new Screen();
        screen.setSize(new Dimension(frame.getWidth(), frame.getHeight()));
        screen.setFocusable(true);
        screen.setVisible(true);
        screen.setBackground(Color.black);
        frame.add(screen);

        frame.setVisible(true);

        screen.start();
        */


        GLCanvas screen = new GLCanvas(caps);
        screen.addGLEventListener(new Driver());

        screen.setVisible(true);
        frame.add(screen);
        frame.setVisible(true);

        // Testing Stuff:
            effect[0] = new RainbowSnow(0.0f, 0.0f, (short)1920);
            // effect[0] = new SplitWave(0.0, 0.0, 1920);
            // effect[0] = new Snow(0.0, 0.0, 1920);
            // effect[0] = new Fire(512.0, 512.0);
        // End Testing Stuff.

        Animator animator = new Animator(screen);
        animator.start();


   }

    @Override
    public void init(GLAutoDrawable drawable) {
        // put your OpenGL initialization code here

        drawable.getGL().setSwapInterval(1); // Ennable V-Sync
    }

    @Override
    public void dispose(GLAutoDrawable drawable) {
        // put your cleanup code here
    }

    @Override
    public void display(GLAutoDrawable drawable) {
        update();
        render(drawable);
    }

    // When called this updates all of the game's logic.
    private void update() {
        for(Effect e : effect) {
            e.update();
        }

        /*
        if(KEY.isKeyPressed(KeyEvent.VK_ESCAPE) || KEY.isKeyPressed(KeyEvent.VK_ALT) && KEY.isKeyPressed(KeyEvent.VK_F4)) {
            isProgramRunning = false;
            System.exit(0);
        }
        */

    }

    // When called this updates the screen.
    private void render(final GLAutoDrawable drawable) {
        GL2 gl = drawable.getGL().getGL2();
        gl.glClear(GL.GL_COLOR_BUFFER_BIT);
        gl.glBlendFunc(GL.GL_SRC_ALPHA, GL.GL_ONE_MINUS_SRC_ALPHA);

        for(Effect e : effect) {
            e.render(gl);
        }

        gl.glFlush();
    }

    @Override
    public void reshape(GLAutoDrawable drawable, int x, int y, int width, int height) {
        // called when user resizes the window
    }
}


1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
/**
    * Renders the particle to the screen.
    * @param gl The graphics object to render with.
    * @param isOval Whether or not to render the particle as an oval.
    */

   public void render(final GL2 gl, final boolean isOval) {

      if(isOval) {
            // TODO Figure out the math for this.
      } else {
            gl.glBegin(GL2.GL_POLYGON);
            gl.glColor4f(color.getRed() / 255, color.getGreen() / 255, color.getBlue() / 255, color.getAlpha() / 100);
            gl.glVertex2f(xCurrent, yCurrent); // Top Left
            gl.glVertex2f(xCurrent + SIZE, yCurrent); // Top Right
            gl.glVertex2f(xCurrent + SIZE, yCurrent + SIZE); // Bottom Right
            gl.glVertex2f(xCurrent, yCurrent + SIZE); // Bottom Left
            gl.glEnd();
      }
   }




If anyone can spot an error or can tell me what I may have done wrong, thanks.
3  Game Development / Shared Code / [Java 2D] Simple Particle System on: 2014-09-14 18:30:36
Hey,

I've been working on/playing around with this particle system for quite some time now and I figured someone might be able to find a use for it. You can view the effects I've already created using it to see how it works. Other than that it's pretty self-explanatory, but if you have any questions or suggestions just comment.

https://github.com/Valkryst/Particle-System/tree/master/Particles/src
4  Discussions / General Discussions / Re: Errors When Setting Up libGDX Project on: 2014-08-26 23:27:49
The latest version as far as I know. Downloaded it straight from https://bitly.com/1i3C7i3 which is from https://github.com/libgdx/libgdx/wiki/Project-Setup-Gradle.

I'm only using Windows Defender and Malwarebytes. I've checked for a .gradle folder, but none exists. In one of my previous tests I installed gradle, but that did nothing so I removed it.
5  Discussions / General Discussions / Errors When Setting Up libGDX Project on: 2014-08-26 23:05:26
Hey,

I've been attempting to setup an libGDX project for the last hour, but no matter what I try, I continue to get this confusingly large set of errors. Does anyone have an idea for what I can try to fix this?

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  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
Generating app in C:\Users\_Valkryst\git\RPG
Executing 'C:\Users\_Valkryst\git\RPG/gradlew.bat clean --no-daemon idea'
To honour the JVM settings for this build a new JVM will be forked. Please consider using the daemon: http://gradle.org/docs/1.11/userguide/gradle_daemon.html.

FAILURE: Build failed with an exception.

* What went wrong:
Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example, an unrecognized jvm option is used.
Please refer to the user guide chapter on the daemon at http://gradle.org/docs/1.11/userguide/gradle_daemon.html
Please read below process output to find out more:
-----------------------
19:58:51.509 [main] DEBUG o.g.l.daemon.bootstrap.DaemonMain - Assuming the daemon was started with following jvm opts: [-Xms128m, -Xmx512m, -Dfile.encoding=windows-1252]
19:58:51.878 [main] DEBUG o.g.l.daemon.server.DaemonServices - Creating daemon context with opts: [-Xms128m, -Xmx512m, -Dfile.encoding=windows-1252]
19:58:51.915 [INFO] [org.gradle.launcher.daemon.server.Daemon] start() called on daemon - DefaultDaemonContext[uid=98e56e09-5cba-4df0-918a-b7a9952b41a0,javaHome=C:\Program Files\Java\jre8,daemonRegistryDir=C:\Users\_Valkryst\.gradle\daemon,pid=10520,idleTimeout=120000,daemonOpts=-Xms128m,-Xmx512m,-Dfile.encoding=windows-1252]
19:58:51.921 [DEBUG] [org.gradle.launcher.daemon.server.DaemonStateCoordinator] updating lastActivityAt to 1409093931921
19:58:51.962 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding IP addresses for network interface lo
19:58:51.963 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Is this a loopback interface? true
19:58:51.964 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding loopback address /127.0.0.1
19:58:51.964 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding loopback address /0:0:0:0:0:0:0:1
19:58:51.965 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding IP addresses for network interface eth0
19:58:51.967 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Is this a loopback interface? false
19:58:51.968 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding IP addresses for network interface eth1
19:58:51.970 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Is this a loopback interface? false
19:58:51.971 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding non-loopback address /fe80:0:0:0:6924:2208:86ef:9577%eth1
19:58:51.971 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding IP addresses for network interface wlan0
19:58:51.972 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Is this a loopback interface? false
19:58:51.973 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding non-loopback address /192.168.0.13
19:58:51.973 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding non-loopback address /fe80:0:0:0:7ca8:7155:903e:7466%wlan0
19:58:51.974 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding IP addresses for network interface net0
19:58:51.975 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Is this a loopback interface? false
19:58:51.976 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding IP addresses for network interface eth2
19:58:51.977 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Is this a loopback interface? false
19:58:51.978 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding non-loopback address /fe80:0:0:0:78b1:86d3:33f:ec1c%eth2
19:58:51.978 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding IP addresses for network interface net1
19:58:51.980 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Is this a loopback interface? false
19:58:51.980 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding non-loopback address /fe80:0:0:0:0:5efe:c0a8:d%net1
19:58:51.981 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding IP addresses for network interface net2
19:58:51.982 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Is this a loopback interface? false
19:58:51.982 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding non-loopback address /2001:0:9d38:90d7:10f2:1188:9c02:7016
19:58:51.983 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding non-loopback address /fe80:0:0:0:10f2:1188:9c02:7016%net2
19:58:51.983 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding IP addresses for network interface wlan1
19:58:51.985 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Is this a loopback interface? false
19:58:51.985 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding non-loopback address /fe80:0:0:0:9482:2bf6:b78f:f913%wlan1
19:58:51.985 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding IP addresses for network interface net3
19:58:51.987 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Is this a loopback interface? false
19:58:51.987 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding IP addresses for network interface net4
19:58:51.988 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Is this a loopback interface? false
19:58:51.989 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding IP addresses for network interface wlan2
19:58:51.990 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Is this a loopback interface? false
19:58:51.990 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding IP addresses for network interface net5
19:58:51.991 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Is this a loopback interface? false
19:58:51.991 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding IP addresses for network interface net6
19:58:51.993 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Is this a loopback interface? false
19:58:51.993 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding IP addresses for network interface net7
19:58:51.994 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Is this a loopback interface? false
19:58:51.994 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding IP addresses for network interface eth3
19:58:51.996 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Is this a loopback interface? false
19:58:51.996 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding IP addresses for network interface net8
19:58:51.997 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Is this a loopback interface? false
19:58:51.998 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding IP addresses for network interface net9
19:58:51.998 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Is this a loopback interface? false
19:58:51.999 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding IP addresses for network interface eth4
19:58:52.000 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Is this a loopback interface? false
19:58:52.000 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding IP addresses for network interface ppp0
19:58:52.001 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Is this a loopback interface? false
19:58:52.001 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding IP addresses for network interface eth5
19:58:52.002 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Is this a loopback interface? false
19:58:52.002 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding IP addresses for network interface ppp1
19:58:52.003 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Is this a loopback interface? false
19:58:52.003 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding IP addresses for network interface eth6
19:58:52.004 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Is this a loopback interface? false
19:58:52.004 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding IP addresses for network interface eth7
19:58:52.005 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Is this a loopback interface? false
19:58:52.005 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding IP addresses for network interface eth8
19:58:52.006 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Is this a loopback interface? false
19:58:52.007 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding IP addresses for network interface wlan3
19:58:52.008 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Is this a loopback interface? false
19:58:52.008 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding IP addresses for network interface wlan4
19:58:52.009 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Is this a loopback interface? false
19:58:52.009 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding IP addresses for network interface wlan5
19:58:52.010 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Is this a loopback interface? false
19:58:52.010 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding IP addresses for network interface wlan6
19:58:52.011 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Is this a loopback interface? false
19:58:52.011 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding IP addresses for network interface wlan7
19:58:52.012 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Is this a loopback interface? false
19:58:52.012 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding IP addresses for network interface wlan8
19:58:52.013 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Is this a loopback interface? false
19:58:52.013 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding IP addresses for network interface wlan9
19:58:52.014 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Is this a loopback interface? false
19:58:52.015 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding IP addresses for network interface wlan10
19:58:52.016 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Is this a loopback interface? false
19:58:52.016 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Adding IP addresses for network interface wlan11
19:58:52.017 [DEBUG] [org.gradle.messaging.remote.internal.inet.InetAddressFactory] Is this a loopback interface? false
19:58:52.018 [DEBUG] [org.gradle.messaging.remote.internal.inet.TcpIncomingConnector] Listening on [7ea23b2a-fc8a-4e3a-90f7-46e2041e2944 port:56920, addresses:[/127.0.0.1, /0:0:0:0:0:0:0:1]].
19:58:52.021 [DEBUG] [org.gradle.launcher.daemon.server.Daemon] Daemon starting at: Tue Aug 26 19:58:52 ADT 2014, with address: [7ea23b2a-fc8a-4e3a-90f7-46e2041e2944 port:56920, addresses:[/127.0.0.1, /0:0:0:0:0:0:0:1]]
19:58:52.021 [INFO] [org.gradle.launcher.daemon.server.DomainRegistryUpdater] Advertising the daemon address to the clients: [7ea23b2a-fc8a-4e3a-90f7-46e2041e2944 port:56920, addresses:[/127.0.0.1, /0:0:0:0:0:0:0:1]]
19:58:52.022 [DEBUG] [org.gradle.launcher.daemon.server.DomainRegistryUpdater] Advertised daemon context: DefaultDaemonContext[uid=98e56e09-5cba-4df0-918a-b7a9952b41a0,javaHome=C:\Program Files\Java\jre8,daemonRegistryDir=C:\Users\_Valkryst\.gradle\daemon,pid=10520,idleTimeout=120000,daemonOpts=-Xms128m,-Xmx512m,-Dfile.encoding=windows-1252]
19:58:52.023 [DEBUG] [org.gradle.launcher.daemon.registry.PersistentDaemonRegistry] Storing daemon address: [7ea23b2a-fc8a-4e3a-90f7-46e2041e2944 port:56920, addresses:[/127.0.0.1, /0:0:0:0:0:0:0:1]], context: DefaultDaemonContext[uid=98e56e09-5cba-4df0-918a-b7a9952b41a0,javaHome=C:\Program Files\Java\jre8,daemonRegistryDir=C:\Users\_Valkryst\.gradle\daemon,pid=10520,idleTimeout=120000,daemonOpts=-Xms128m,-Xmx512m,-Dfile.encoding=windows-1252]
19:58:52.032 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire exclusive lock on daemon addresses registry.
19:58:52.035 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired.
19:58:52.036 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
19:58:52.041 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire exclusive lock on daemon addresses registry.
19:58:52.041 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired.
19:58:52.044 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
19:58:52.050 [ERROR] [system.err]
19:58:52.050 [ERROR] [system.err] FAILURE: Build failed with an exception.
19:58:52.051 [ERROR] [system.err]
19:58:52.051 [ERROR] [system.err] * What went wrong:
19:58:52.051 [ERROR] [system.err] Could not write cache value to 'C:\Users\_Valkryst\.gradle\daemon\1.11\registry.bin'.
19:58:52.051 [ERROR] [system.err]
19:58:52.052 [ERROR] [system.err] * Try:
19:58:52.052 [ERROR] [system.err] Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
19:58:52.054 [INFO] [org.gradle.launcher.daemon.bootstrap.DaemonMain] Daemon[pid = 10520] process has finished.
19:58:52.054 [DEBUG] [org.gradle.launcher.daemon.registry.PersistentDaemonRegistry] Removing daemon address: [7ea23b2a-fc8a-4e3a-90f7-46e2041e2944 port:56920, addresses:[/127.0.0.1, /0:0:0:0:0:0:0:1]]
19:58:52.055 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire exclusive lock on daemon addresses registry.
19:58:52.055 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired.
19:58:52.056 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
19:58:52.057 [DEBUG] [org.graDone!
dle.cache.intTo import in Eclipse: File -> Import -> General -> Exisiting Projects into Workspace
erTo import to Intellij IDEA: File -> Open -> YourProject.ipr
nal.DefaultFileLockManager] Waiting to acquire exclusive lock on daemon addresses registry.
19:58:52.057 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired.
19:58:52.058 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry.
19:58:52.065 [DEBUG] [org.gradle.launcher.daemon.server.Daemon] VM shutdown hook was unable to remove the daemon address from the registry. It will be cleaned up later.
org.gradle.api.GradleException: Could not write cache value to 'C:\Users\_Valkryst\.gradle\daemon\1.11\registry.bin'.
   at org.gradle.cache.internal.SimpleStateCache.serialize(SimpleStateCache.java:74)
   at org.gradle.cache.internal.SimpleStateCache.access$100(SimpleStateCache.java:28)
   at org.gradle.cache.internal.SimpleStateCache$2.run(SimpleStateCache.java:50)
   at org.gradle.cache.internal.DefaultFileLockManager$DefaultFileLock.doWriteAction(DefaultFileLockManager.java:173)
   at org.gradle.cache.internal.DefaultFileLockManager$DefaultFileLock.writeFile(DefaultFileLockManager.java:163)
   at org.gradle.cache.internal.OnDemandFileAccess.writeFile(OnDemandFileAccess.java:56)
   at org.gradle.cache.internal.SimpleStateCache.set(SimpleStateCache.java:48)
   at org.gradle.cache.internal.FileIntegrityViolationSuppressingPersistentStateCacheDecorator.set(FileIntegrityViolationSuppressingPersistentStateCacheDecorator.java:38)
   at org.gradle.cache.internal.FileIntegrityViolationSuppressingPersistentStateCacheDecorator.update(FileIntegrityViolationSuppressingPersistentStateCacheDecorator.java:46)
   at org.gradle.launcher.daemon.registry.PersistentDaemonRegistry.remove(PersistentDaemonRegistry.java:109)
   at org.gradle.launcher.daemon.server.Daemon$1.run(Daemon.java:100)
Caused by: java.io.FileNotFoundException: C:\Users\_Valkryst\.gradle\daemon\1.11\registry.bin (Access is denied)
   at java.io.FileOutputStream.open(Native Method)
   at java.io.FileOutputStream.<init>(Unknown Source)
   at java.io.FileOutputStream.<init>(Unknown Source)
   at org.gradle.cache.internal.SimpleStateCache.serialize(SimpleStateCache.java:67)
   ... 10 more


* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
6  Discussions / Miscellaneous Topics / Re: Quad core + 2gb of ram on: 2014-05-30 13:32:42
I would not recommend having less than 4 gigs of memory. If you want to do a lot of multitasking, then you will be hitting that 2 gig limit all the time.

Seconding this. I use at least 6GB of RAM at all times while programming & working on side projects.
7  Game Development / Newbie & Debugging Questions / Re: Background image on: 2014-05-27 19:04:10
"Fit in memory" means that the map is small enough to be loaded all at once without much, if any, culling. For large maps you need to use culling to make sure that the game doesn't end up hogging all of the system resources.

Just think about how to make the map and all that work. If you draw it out and that then you'll figure it out eventually. That's how I ended up getting it at least.
8  Game Development / Newbie & Debugging Questions / Re: [solved] How to have multiple tiles a player can't go through? on: 2014-05-19 00:30:10
In response to Rayvolution's post... You don't need to do any libGDX or slick2d specific collision detection classes. Just use the Rectangle class that already exists in Java and work with it. Saves you from having to learn a lot more and it'll work well enough for most purposes.
9  Game Development / Newbie & Debugging Questions / Re: How to have multiple tiles a player can't go through? on: 2014-05-18 11:15:13
Just use Rectangles and check for intersection.
10  Discussions / General Discussions / Re: Is it just me, or does everyone's GUI code look like spaghetti? on: 2014-05-15 18:49:27
For checking if the mouse is hovering over something. Why not just use Rectangles and detect intersection? That's what I do to make my custom buttons work.
11  Game Development / Newbie & Debugging Questions / Re: How do you load and setup your levels/menus? on: 2014-05-15 04:58:10
well menus are hardcoded - what do you load ?

as for maps I just developed a map editor which serializes using kryo the map and can load it again.
Never that simple but yeah. short answer is write a parser or use serialization.

what exactly are you saving/loading ?

I wrote a simple framework for custom interface components. As a simple example... When creating a button I need to load the X/Y coordinates of the button along with three sprites for the default, clicked, and hovered states of the button. The same thing applies to all tiles, NPCs, etc... in the game. To make it really simple. Almost nothing is hard-coded with the way I have it set up. A few things will probably have to be hard-coded eventually, but everything is just "load-n-go" atm.

Your serialization idea sounds like a simple solution even though it would require a fair bit of extra work to setup at first. Thanks, I'll look into it.
12  Discussions / General Discussions / Re: New Personal Virtual Reality Headset System – ANTVR KIT on: 2014-05-15 03:20:28
Why isn't wireless energy transmission mainstream yet? This is exactly the type of thing to use it for.

Don't quote me on this, but from what I remember... The further the energy needs to be transmitted the higher the loss of energy. So it's pretty much only useful for short-distance transmission which cuts out a lot of the customer base (businesses and stuff like that) and so there is less demand for the technology. This causes the cost of production to go up and make using wireless energy more expensive which then stops people from using it.

Hopefully that makes some sense. I tried to remember what I read about this from a thread on Reddit a while back.
13  Game Development / Newbie & Debugging Questions / How do you load and setup your levels/menus? on: 2014-05-15 03:14:35
Hey,

I've been trying to think of a good, and simple, way to load all the information (data  in text files, sprites, etc...) and setup levels/menus for my game. So-far I've managed to write up a few different methods for to load all of the files and then convert those files into Entities, interface pieces, etc... Although all of the ways I've tried do end up working to some degree, the code is an utter train-wreck compared to how nice and neat the rest of my code is. It'd probably be easier if I wanted to code more of the data and that in, but I'm trying to set it up so that you just need to have the right folder structure and files to load anything into the game.

Since it wont hurt to ask, how do you load your levels, menus, and whatever else?

14  Game Development / Newbie & Debugging Questions / Re: save game-- how to on: 2014-05-14 02:30:09
Serialization seems the easiest route to me. It's prettyeasy to figure out and not too tough to implement if you code with it in mind.
15  Game Development / Newbie & Debugging Questions / [Java2D] Need some explanation on an old tutorial. on: 2014-05-12 19:52:26
Hey,

I'm trying to rewrite the game loop that I've been using for every single project I've made recently, but some information in the tutorial isn't very clear to me. Could someone explain why, in the variable timestep game-loop, the number 1000000000 is used and whether or not delta actually matters at all.

Throughout everything I've made with the variable timestep game-loop, I've never used delta and everything has worked just as it should. The one time where I did do a quick experiment by using delta in my particle system, everything went haywire and the particle movement bugged out. This leads me to believe that the delta variable doesn't need to be used.

Oh, one additional question. Is there a simpler game-loop that can be used which performs the same as the variable timestep game-loop in this tutorial?

The variable timestep game-loop was taken from this tutorial: http://www.java-gaming.org/index.php?topic=24220.0


Thanks for any help.
16  Discussions / Miscellaneous Topics / Re: What do you develop your games on? on: 2014-05-11 04:16:08
Laptop with:

  • 2x Nvidia GeForce GT 650m
  • 16GB RAM
  • Intel i7 CPU
  • Two monitors (1920x1080)
  • About 6TB HDD space, soon to be 8 or 10. (Mostly always-attached external HDDs)
  • Windows 8.1 x64
17  Discussions / General Discussions / Re: [LIBGDX] Particles disappearing and then reappearing on: 2014-04-05 21:27:27
Thanks for the help Phil. I have the code looking similar to what you put, but I kept it closer to my original way so that the transition looks better.

1  
2  
3  
4  
5  
6  
if(counter == 10) {
         for(int i=0;i<RANDOM.nextInt(1800) + 120;i++) { newParticle(new Color(red/255f, green/255f, blue/255f, 1.0f), RANDOM.nextInt(8) + 2, 40); }
         counter = 0;
      } else {
         counter++;
      }



Working for up to 200k particles, when I hit 300k it slows down to a snails crawl.
18  Discussions / General Discussions / Re: [LIBGDX] Particles disappearing and then reappearing on: 2014-04-05 21:03:59
You should have between 120 to 1920 particles every time the counter hits 10. They all use the same color object so 1 color.

Annnd after a second I thought that since they were all referring to the same color object then I just changed it to create a new color object for every single particle and it was fixed. Never had this bug with the non-libGDX version.
19  Discussions / General Discussions / Re: [LIBGDX] Particles disappearing and then reappearing on: 2014-04-05 20:54:00
I have the code modified to test with a single snowflake on the screen. The numbers just reduce down to almost 0.0, and before it can get to 0.0 it's removed just as it should be.

http://pastebin.com/WsGXAp4K

I assume that you're testing with the unmodified code which would have a ton of snowflakes falling at once and not show the numbers going straight down.
20  Discussions / General Discussions / Re: [LIBGDX] Particles disappearing and then reappearing on: 2014-04-05 20:47:45
Had it slightly different. Yeah, the values are always the same when I change it to how you've written it. Still looks like it's working properly.

21  Discussions / General Discussions / Re: [LIBGDX] Particles disappearing and then reappearing on: 2014-04-05 20:37:06
No idea what a quad is, just started with libGDX a few hours ago.

May I direct you to the recent OGL tut by SHC outlining the basics of what goes on 'under the covers' of libGDX:
http://www.java-gaming.org/topics/lwjgl-tutorial-series-the-opengl-rendering-pipeline/32661/view.html

Thanks, I'll check it out in a few minutes.
22  Discussions / General Discussions / Re: [LIBGDX] Particles disappearing and then reappearing on: 2014-04-05 20:28:56
It took me 1.3 hours to find it, I love debugging. Indeed I just hate to not know the solution  Roll Eyes
So I will go for a quizz  Grin
(No that's not because I am evil, that's just how some other guy helped me and you learn most)
First hint:
You create an object but you don't use it every time you create it.


The Color object in the update() method of the RainbowSnow class? Moving that within the if statement gives no change.
23  Discussions / General Discussions / Re: [LIBGDX] Particles disappearing and then reappearing on: 2014-04-05 20:23:44
What do you think that rectangle is? A quad perhaps? Hmm...

A point combined with a width and height that's sent somewhere as an instruction for which pixels on the screen to color. No idea what a quad is, just started with libGDX a few hours ago.
24  Discussions / General Discussions / Re: [LIBGDX] Particles disappearing and then reappearing on: 2014-04-05 20:15:40
Disable all texturing and coloring and see if the actual geometry disappears. That way you can rule out a lot of stuff.

Huh? There are no textures or geometry. I'm just drawing rectangles on the screen using rgba colors and a ShapeRenderer object.
25  Discussions / General Discussions / Re: [LIBGDX] Particles disappearing and then reappearing on: 2014-04-05 18:48:12
Fading out and them removing I guess?

If the rgb color values go < 0, they reset to 1.

This could be it.

The rgb colors should never go below 0 with the way I have it set up. I'll double check that though.

Edit:
It doesn't seem to be related to the rgb values as far as I've seen in my tests.
26  Discussions / General Discussions / [LIBGDX] Particles disappearing and then reappearing on: 2014-04-05 18:13:09
Hey,

I've just, hopefully, finished converting my particle system from pure Java to libGDX. Everything seems to be working properly, except for the 'death' of the particles. The particles die and then reappear, or so it seems, for some reason unknown to me.

Each particle starts with a certain lifetime, and each update to the particle decreases the remaining lifetime. The alpha of the particle is calculated using (float)(remainingLife/totalLife). When the lifeTime reaches 0 then the particle is deleted because it's alpha is 0.

Here's the compiled project, you can see how the particles disappear and reappear. Exit with Alt+F4.
https://mega.co.nz/#!IstGjR6b!VZCkZ9ClDBUedZLHIPnchx9thb4Gs_asFvnlZpX7qo8



I'm thinking that the error is in how I setup libGDX in the Driver/Main classes, but it could also be with how I set the color/alpha in the RainbowSnow/Particle classes. Normally I'd be able to figure this kind of thing out pretty quickly, but I barely know how to use libGDX atm. Thanks for any ideas.

Driver:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
package core.desktop;

import java.awt.Dimension;
import java.awt.Toolkit;

import com.badlogic.gdx.backends.lwjgl.LwjglApplication;
import com.badlogic.gdx.backends.lwjgl.LwjglApplicationConfiguration;

import core.Main;

public class DesktopLauncher {
   public static void main (String[] arg) {
      Dimension screenDimensions = Toolkit.getDefaultToolkit().getScreenSize();
     
      LwjglApplicationConfiguration config = new LwjglApplicationConfiguration();
      config.title = "Particle System";
      config.width = (int)screenDimensions.getWidth();
      config.height = (int)screenDimensions.getHeight();
      config.fullscreen = true;
      config.useGL30 = true;
     
        new LwjglApplication(new Main(), config);
   }
}


Main:
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  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
package core;

import com.badlogic.gdx.ApplicationAdapter;
import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;

import effect.Effect;
import effect.RainbowSnow;

public class Main extends ApplicationAdapter {
   Effect e;
   ShapeRenderer shapeRenderer;

   @Override
   public void create() {
      e = new RainbowSnow(0.0, Gdx.graphics.getHeight() + 50, Gdx.graphics.getWidth());
      shapeRenderer = new ShapeRenderer();
   }

   @Override
   public void render() {
      ((RainbowSnow)e).update();
     
      Gdx.gl.glClearColor(0, 0, 0, 0);
      Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
     
      ((RainbowSnow)e).render(shapeRenderer, e.getIsOval());
   }

   @Override
   public void resize(int width, int height) {
   }
   
   @Override
   public void pause() {
   }

   @Override
   public void resume() {
   }

   @Override
   public void dispose() {
   }
}


Effect:
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  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
package effect;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Random;

import particle.Particle;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.GL30;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer.ShapeType;

public class Effect {
   protected final static Random RANDOM = new Random();
   /** A collection of particles that make up the snow.*/
   protected final List<Particle> PARTICLES = new ArrayList<Particle>();
   /** The origin of this snow on the X-axis.*/
   protected final double ORIGIN_X;
   /** The origin of this snow on the Y-axis.*/
   protected final double ORIGIN_Y;
   /** Whether or not to render the particles as ovals. If not then render as squares. Ovals are extremely CPU intensive for large effects*/
   protected final boolean IS_OVAL;
   protected Iterator<Particle> iterator;
   protected int counter = 0;
   
   public Effect(final double ORIGIN_X, final double ORIGIN_Y, final boolean IS_OVAL) {
      this.ORIGIN_X = ORIGIN_X;
      this.ORIGIN_Y = ORIGIN_Y;
      this.IS_OVAL = IS_OVAL;
   }
   
   /**
    * Updates the effect.
    */

   public void Update() {}
   
   /**
    *  Renders the snow to the screen.
    * @param g Graphics object with which to draw.
    */

   public void render(final ShapeRenderer SHAPE_RENDERER, final boolean IS_OVAL) {
      if(counter == 0) { System.out.println(PARTICLES.size()); }
     
      Gdx.gl.glEnable(GL30.GL_BLEND);
      Gdx.gl.glBlendFunc(GL30.GL_SRC_ALPHA, GL30.GL_ONE_MINUS_SRC_ALPHA);
      SHAPE_RENDERER.begin(ShapeType.Filled);
      iterator = PARTICLES.iterator();
      while(iterator.hasNext()) {
         iterator.next().render(SHAPE_RENDERER, IS_OVAL);
      }
      SHAPE_RENDERER.end();
      Gdx.gl.glDisable(GL30.GL_BLEND);
   }
   
   /** @return Whether or not to render the particles as ovals. If not then render as squares. */
   public boolean getIsOval() { return IS_OVAL; }
}


RainbowSnow:
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  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
package effect;


import com.badlogic.gdx.graphics.Color;

import particle.Particle;

/**
 * Represents rainbow snow fall.
 * @author Valkryst
 * --- Last Edit 05-Apr-2014
 */

public class RainbowSnow extends Effect {
   /** The length (x-axis) of the screen. */
   private final double SCREEN_LENGTH;
   private final double COLOR_CHANGE_CONSTANT = 0.25;
   private float red = 255, green = 0, blue = 0;
   private boolean isRed = false, isGreen = true, isBlue = false;
   
   /**
    * Constructs a new Snow object.
    */

   public RainbowSnow(final double ORIGIN_X, final double ORIGIN_Y, final double SCREEN_LENGTH) {
      super(ORIGIN_X, ORIGIN_Y - 50, false);
      this.SCREEN_LENGTH = SCREEN_LENGTH;
   }
   
   /**
    * Updates the snow.
    */

   public void update() {
      Color c = new Color();
      c.set(red/255f, green/255f, blue/255f, 1.0f);

      if(counter == 10) {
         for(int i=0;i<RANDOM.nextInt(1800) + 120;i++) { newParticle(c, RANDOM.nextInt(8), 40); }
         counter = 0;
      } else {
         counter++;
      }
     
      if(isRed) {
         if(blue > 0) { blue -= COLOR_CHANGE_CONSTANT; }

         if(red < 255) {
            red += COLOR_CHANGE_CONSTANT;
         } else if(red == 255 && blue == 0) {
            isRed = false;
            isGreen = true;
         }
      } else if(isGreen) {
         if(red > 0) { red -= COLOR_CHANGE_CONSTANT; }
         
         if(green < 255) {
            green += COLOR_CHANGE_CONSTANT;
         } else if(green == 255 && red == 0) {
            isGreen = false;
            isBlue = true;
         }
      } else if(isBlue) {
         if(green > 0) { green -= COLOR_CHANGE_CONSTANT; }
         
         if(blue < 255) {
            blue += COLOR_CHANGE_CONSTANT;
         } else if(blue == 255 && green == 0) {
            isBlue = false;
            isRed = true;
         }
      }

      iterator = PARTICLES.iterator();
      while(iterator.hasNext()) {
         if(iterator.next().update()) {
            iterator.remove();
         }
      }
   }
   
   /**
    * Creates a new Particle object.
    * @param sizeIn The size, in pixels^2, of the new Particle.
    * @param decayTimeIn The number of movements before the new Particle decays.
    */

   public void newParticle(final Color COLOR, int SIZE, int LIFE) {
      PARTICLES.add(new Particle(RANDOM.nextInt((int)SCREEN_LENGTH), super.ORIGIN_Y, RANDOM.nextDouble() * (RANDOM.nextBoolean() ? -2 : 2), RANDOM.nextDouble() * -2.5, 0.0050 *(RANDOM.nextBoolean() ? -1 : 1), 0.0, SIZE + RANDOM.nextInt(8), LIFE + RANDOM.nextInt(800), COLOR));
   }
}


Particle:
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  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
package particle;

import java.awt.Dimension;
import java.awt.Toolkit;

import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;

/**
 * Represents a particle in 2D space.
 * @author Valkryst
 * --- Last Edit 05-Apr-2014
 */

public class Particle {
   private final static Dimension SCREEN_DIMENSIONS = Toolkit.getDefaultToolkit().getScreenSize();
   /** The location of the particle on the X-axis. */
   private double x;
   /** The location of the particle on the Y-axis. */
   private double y;
   /** The change in X, per update, of the particle. */
   private double dx;
   /** The change in Y, per update, of the particle. */
   private double dy;
   /** The gravitational pull to the left (negative) and right (positive) acting on this particle. */
   private final double GRAVITY_X;
   /** The gravitational pull to the up (negative) and down (positive) acting on this particle. */
   private final double GRAVITY_Y;
   /** The size in pixels^2 of the particle. */
   private final int SIZE;
   /** The remaining lifetime of the particle. */
   private double currentLife;
   /** The total lifetime of the particle. */
   private final double TOTAL_LIFE;
   /** The color of the particle. */
   private Color color;
   
   /**
    * Constructs a new particle with the specified data.
    * @param X The location of the particle on the X-axis.
    * @param Y The location of the partivcle on the Y-axis.
    * @param DX The change in X, per update, of the particle.
    * @param DY The change in Y, per update, of the particle.
    * @param GRAVITY_X The gravitational pull to the left (negative) and right (positive) acting on this particle.
    * @param GRAVITY_Y The gravitational pull to the up (negative) and down (positive) acting on this particle.
    * @param SIZE The size in pixels^2 of the particle.
    * @param LIFE The remaining lifetime of the particle.
    * @param COLOR The color of the particle.
    */

   public Particle(final double X, final double Y, final double DX, final double DY, final double GRAVITY_X, final double GRAVITY_Y, final int SIZE, final double LIFE, final Color COLOR) {
      x = X;
      y = Y;
      dx = DX;
      dy = DY;
      this.GRAVITY_X = GRAVITY_X;
      this.GRAVITY_Y = GRAVITY_Y;
      this.SIZE = SIZE;
      currentLife = LIFE;
      TOTAL_LIFE = LIFE;
      color = COLOR;
   }
   
   /**
    * Updates the particle's position, change in x, change in y,
    * remaining lifetime, and color.
    * @return Whether the particle is 'dead' or not.
    */

   public boolean update() {
      if(x > SCREEN_DIMENSIONS.width + 32 || x < -32 || y > SCREEN_DIMENSIONS.height + 32) {
         return true;
      } else {
         x += dx;
         y += dy;
         dx += GRAVITY_X;
         dy += GRAVITY_Y;
         currentLife--;
         color.set(color.r, color.g, color.b, (float)(currentLife/TOTAL_LIFE));
         return (currentLife <= 0 ? true : false);
      }
   }
   
   /**
    * Renders the particle to the screen.
    * @param G The shaperenderer object to render with.
    * @param IS_OVAL Whether or not to render the particle as an oval.
    */

   public void render(final ShapeRenderer SHAPE_RENDERER, final boolean IS_OVAL) {
      SHAPE_RENDERER.setColor(color);

      if(IS_OVAL) {
         SHAPE_RENDERER.circle((int)x-(SIZE / 2), (int)y-(SIZE / 2), SIZE, SIZE); //x-(size/2) & y-(size/2) make sure the particle is rendered at (x, y).
      } else {
         SHAPE_RENDERER.rect((int)x-(SIZE / 2), (int)y-(SIZE / 2), SIZE, SIZE); //x-(size/2) & y-(size/2) make sure the particle is rendered at (x, y).
      }
   }
}



Edit:
Ignore the JavaDocs if they don't make sense. I haven't updated them recently.
27  Game Development / Newbie & Debugging Questions / Re: Problem with Writing text to a File on: 2014-03-31 00:28:14
To print to text file:
1  
2  
3  
4  
5  
6  
7  
8  
9  
public static void writeText(String[] text) {
   try {
       PrintWriter out = new PrintWriter((new FileWriter("blahblahblah.txt", false));
       for(String s : text) { out.println(s); }
       out.close();
   } catch (IOException e) {
       e.printStackTrace();
   }
}


There is also a 1 liner to read an entire text file at once into a String array, but I can't seem to find it atm. Something to do with NIO.
28  Game Development / Newbie & Debugging Questions / Re: Troubles Implementing Map Scrolling on: 2014-03-30 14:58:28
=O

I was just messing around with the code while writing a reply about it almost working and it worked. I just combined the ideas in ctomni's code and what Liquid said in his comment and now it works perfectly!
29  Game Development / Newbie & Debugging Questions / Re: Troubles Implementing Map Scrolling on: 2014-03-29 18:57:41
Why do you "set back" player position, if you didn't change it in the first place?

Because it just updates the player's position after figuring out how much to scroll the map so that the player's position won't change on the map when it scrolls to show the next bit of the map. The user controls the player's movement.
30  Game Development / Newbie & Debugging Questions / Re: Troubles Implementing Map Scrolling on: 2014-03-29 18:23:41
I don't.

Whenever the player's x position is greater than half of the screen it does (playerX - halfScreenWidth) to find the difference. Then subtracts that from the xOffset. Next, the player's position is set back to halfScreenWidth so that it lines up with where it was before the map was moved back by the xOffset.

Pages: [1] 2 3 ... 14
 

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

The first screenshot will be displayed as a thumbnail.

Mr.CodeIt (23 views)
2014-12-23 03:34:11

rwatson462 (53 views)
2014-12-15 09:26:44

Mr.CodeIt (45 views)
2014-12-14 19:50:38

BurntPizza (85 views)
2014-12-09 22:41:13

BurntPizza (110 views)
2014-12-08 04:46:31

JscottyBieshaar (78 views)
2014-12-05 12:39:02

SHC (89 views)
2014-12-03 16:27:13

CopyableCougar4 (94 views)
2014-11-29 21:32:03

toopeicgaming1999 (155 views)
2014-11-26 15:22:04

toopeicgaming1999 (151 views)
2014-11-26 15:20:36
Resources for WIP games
by kpars
2014-12-18 10:26:14

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