Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (707)
Games in Android Showcase (207)
games submitted by our members
Games in WIP (781)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: 1 2 3 [4] 5 6 ... 10
 31 
 on: 2017-01-19 13:38:13 
Started by DayTripperID - Last post by DayTripperID
Sorry, it isn't obvious in the code I provided, but the speed is non-directional. Mob.LEFT and Mob.RIGHT are static final ints, not enums, representing -1 and 1, respectively.

When xa is updated, the formula is xa = xspeed * xdir, then xa is added to x.

Nonetheless, I mis-diagnosed the bug last night. What is really going on is that if I press the second button while the first button is still pressed, a KeyPressedEvent is fired, causing the player to go in the other direction, but then when I release one of them, a KeyReleasedEvent is fired, causing the player to stand still.

Here is a test demo so you can see exactly what I mean: https://www.dropbox.com/s/g25yfjk8v6ilx4r/breakit.jar?dl=0

It's not finished so you will see some obvious bugs.

 32 
 on: 2017-01-19 13:21:49 
Started by pepdeveloper - Last post by pepdeveloper
Hey!
I have read about gradle, about hotswap and about various configurations and I can not understand practically anything.
All with LibGdx.
In Eclipse, if you click on debug "your project", you can change code, save and see it instantly in your app.
In Android Studio this doesn't happen and in the terminal with "gradlew.bat desktop:run", for example, neither. The closest thing I have achieved has been run from the terminal "gradlew.bat desktop:run -t" and when I close the app, make a code-change, and save, the app will open with the new changes. (Which is similar to what android studio does)

My question is, to what exactly is this behavior due? Can you get it from the terminal?



Thanks!!  Cheesy Cheesy

 33 
 on: 2017-01-19 11:15:30 
Started by BurntPizza - Last post by SkyAphid
We're currently at a stage in development for Robot Farm where I'm mostly waiting on everyone to check in with their stuff so we can push out the trailer and I can resume work on the last of what I have to do. In the mean time, I've been writing up a design document for a game idea I had for fun, for down the road when we're trying to decide what to make next. Design docs are always really fun to write up!

 34 
 on: 2017-01-19 09:43:48 
Started by BurntPizza - Last post by kevglass
Started working on more functional stuff like hit boxes and blocking zones. Need to doodle up a house and a wall shortly.



Cheers,

Kev

 35 
 on: 2017-01-19 03:30:13 
Started by DayTripperID - Last post by Archive
Umm could it possibly be because A and D counteract eachother?

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
 public boolean onKeyPressed(KeyPressedEvent e) {
      System.out.println(e.getKey());
      if(e.getKey() == 65) {
         player.setxdir(Mob.LEFT);
         player.setxspeed(3); //      <---- Move player left 3 units
      }
     
      if(e.getKey() == 68) {
         player.setxdir(Mob.RIGHT);
         player.setxspeed(3); //      <---- Move player right 3 units... If both left and right are pressed, the overall movement is 0.
      }
      return false;
   }

 36 
 on: 2017-01-19 02:50:26 
Started by DayTripperID - Last post by DayTripperID
Hey guys,

So I've been switching from polling to interrupting for my keyboard input handling and I've run into a quirk with KeyEvent. These are my keyPressed and keyReleased methods defined in my KeyListener:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
public void keyPressed(KeyEvent e) {
      System.out.println(e.getKeyCode());
      KeyPressedEvent event = new KeyPressedEvent(e.getKeyCode(), Event.Type.KEY_PRESSED);
      Engine.onEvent(event);
   }

   public void keyReleased(KeyEvent e) {
      KeyReleasedEvent event = new KeyReleasedEvent(e.getKeyCode(), Event.Type.KEY_RELEASED);
      Engine.onEvent(event);
   }


I've coded up a rough event listener to do some preliminary testing with this implementation:

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  
package breakit.mob.player;

import breakit.mob.Mob;
import engine.event.Event;
import engine.event.EventDispatcher;
import engine.event.EventListener;
import engine.event.keyboard.KeyPressedEvent;
import engine.event.keyboard.KeyReleasedEvent;

public class PlayerKeyListener implements EventListener {

   private Player player = null;
   
   public void init(Player player) {
      this.player = player;
   }
   
   @Override
   public void onEvent(Event event) {
      EventDispatcher dispatcher = new EventDispatcher(event);
      dispatcher.dispatch(Event.Type.KEY_PRESSED, (Event e) -> (onKeyPressed((KeyPressedEvent) e)));
      dispatcher.dispatch(Event.Type.KEY_RELEASED, (Event e) -> (onKeyReleased((KeyReleasedEvent) e)));
   }
   
   public boolean onKeyPressed(KeyPressedEvent e) {
      System.out.println(e.getKey());
      if(e.getKey() == 65) {
         player.setxdir(Mob.LEFT);
         player.setxspeed(3);
      }
     
      if(e.getKey() == 68) {
         player.setxdir(Mob.RIGHT);
         player.setxspeed(3);
      }
      return false;
   }
   
   public boolean onKeyReleased(KeyReleasedEvent e) {
      player.setxdir(Mob.NONE);
      player.setxspeed(0);
      return false;
   }
   
}


fyi 68 is 'a' and 65 is 'd', for left and right. It's not finished, and I won't use if statements or literals in the final implementation; I just drew up something quick and dirty for some testing.

Anyway, what PlayerKeyListener does is move the player left or right depending on whether a or d is pressed. The problem I've run into is that if both 'a' and 'd' are pressed simultaneously, meaning for example if I press 'a', hold it, then press 'd' while still holding down 'a', or vice versa, the player stops.

With this implementation, the only way that could possibly happen is if a KeyReleasedEvent is fired, even though I never released a key, but rather pressed an additional key while holding the original key down.

*EDIT*  This was an inaccurate description of the bug. What is actually happening is that when the second key is pressed, while the first one is held down, the player changes direction, but when one of either of the keys is released,  a KeyReleasedEvent is fired, causing the player to stop, even though one of the two buttons is still being held.

So I was wondering if anybody had an answer as to why this is happening. I thought somebody might have experienced this at some point and has figured it out.

I can provide more code if needed as there are a few custom classes. FYI,  I learned if this from this tutorial:
https://www.youtube.com/watch?v=yD47_hq75q0

The tutorial uses the mouse, I merely modified it to use the keyboard instead and ditched the LayerStack in favor of only one Listener at a time, as my game doesn't require layers. It's only about 45 minutes long if anybody wants to watch and get a better idea of what I'm implementing.

I probably won't reply to any posts until tomorrow because right now I have to shift gears to other tasks.

Thank you for any help in debugging this!

 37 
 on: 2017-01-18 23:00:47 
Started by philfrei - Last post by philfrei
The screen with dunes and stars is background on the main game screen. Foreground is coming.

Project got bumped by work (thank you, Microsoft, for causing needless churn and billable hours with updates that aren't 100% compatible with older versions), two sheet music orders to print (and printer heads that turned out to be cleanable--thought they were destroyed by inexpensive, refilled ink cartridges--almost signed away publishing rights when I thought printer was goner), an article invited to write for the hyperphysics site (almost done), finishing application to tutor on Wyzant. Hopefully I will be back on this by next week at the latest!

Yes, also found the API doc on AnimationTimer being executed on JFX application thread. Thanks again!

 38 
 on: 2017-01-18 20:40:44 
Started by Archive - Last post by Archive
Here are screenshots of all the demos I've put together, most of these are from the opengl redbook converted to work with my engine. Some I've created on my own, and others I've found on the internet.

All of the following images have been rendered in real time in FFP Smiley

basic2d.java (basic 2d graphics in the engine)

blockfilter.java (block filtering on the bottom plane, or single level mipmapping @theagentd)

chaos.java (chaos using the growth formula x_(n+1) = L * x_n * (1-x_n))

checker.java (showing off the texture filtering, from left to right: nearest, dithered, bilinear)

colormat.java (color material)

cube.java (really basic 3D)

dither.java (showing off the dithered-paletted graphics mode)

dmtex.java (multitexturing)

fog.java (exponential fog)

gears.java (ahh the gears program...)

mandelbrot.java (this one isn't rendered in real time, it takes around 5 seconds to generate the image)

material.java (redbook 101)

movelight.java (redbook 101 as well)

polyhedra.java (my own program that shows the built in tetrahedron, icosahedron, octahedron, and dodecahedron functions)

quad.java (a super detailed and interactive demo of quadrics)

quadric.java (redbook quadrics)

robot.java (redbook... showing model matrix capabilities)

scene.java (vanilla redbook)

scube.java (cool cube shadow using a shadow matrix, [shadow is dithered but blended post-render])

smooth.java (vertex interpolation)

spheremap.java (sphere mapping and multitexturing [checkerboard and red-green-yellow gradient textures])

steam.java (found this neat program online, has a nice animated and controllable steam engine thing)

vidfilter.java (post-render video filtering)

watersurf.java (another one I found online but heavily modified. Surface is sphere mapped and perlin noise is used)

wave.java (also found this online, this wave is animated and stored in a sequence unlike the previous one)

 39 
 on: 2017-01-18 20:19:02 
Started by BurntPizza - Last post by Archive
Wow! Tons of work done recently.



Added entities:
Entity-player collision (Vertical cylinder)
Entity-world collision (Ellipsoid)
Entity-ray collision (Ellipsoid)

Added shooting the entity with blood particles (he also gets redder the longer you shoot him) Smiley
Found/fixed numerous bugs and issues with the renderer and fixed the memory leaks.

Optimized frustum-aabb test.
Added an in-game console that is openable by pressing TAB. You can type and use commands just like you would in your computer's console/terminal (you can also scroll up and down it with the page up/down keys and move through type history with up/down arrow keys)

Made it so that only bilinear filtered textures are drawn with 256 colors, dithered and nearest-neighbor are true color.
Fixed up sphere mapping issue. added legacy opengl primitives like POINT, LINES, LINE_STRIP, LINE_LOOP, TRIANGLE_FAN, TRIANGLE_STRIP, QUAD_STRIP (no polygon :p)




 40 
 on: 2017-01-18 19:32:22 
Started by philfrei - Last post by J0
So... this is only a title screen?

Pages: 1 2 3 [4] 5 6 ... 10
 
Galdo (340 views)
2017-01-12 13:44:09

Archive (497 views)
2017-01-02 05:31:41

0AndrewShepherd0 (961 views)
2016-12-16 03:58:39

0AndrewShepherd0 (898 views)
2016-12-15 21:50:57

Lunch (1030 views)
2016-12-06 16:01:40

ral0r2 (1264 views)
2016-11-23 16:08:26

ClaasJG (1360 views)
2016-11-10 17:36:32

CoffeeChemist (1370 views)
2016-11-05 00:46:53

jay4842 (1455 views)
2016-11-01 19:04:52

theagentd (1232 views)
2016-10-24 17:51:53
List of Learning Resources
by elect
2016-09-09 09:47:55

List of Learning Resources
by elect
2016-09-08 09:47:20

List of Learning Resources
by elect
2016-09-08 09:46:51

List of Learning Resources
by elect
2016-09-08 09:46:27

List of Learning Resources
by elect
2016-09-08 09:45:41

List of Learning Resources
by elect
2016-09-08 08:39:20

List of Learning Resources
by elect
2016-09-08 08:38:19

Rendering resources
by Roquen
2016-08-08 05:55:21
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!