Java-Gaming.org    
Featured games (78)
games approved by the League of Dukes
Games in Showcase (429)
Games in Android Showcase (89)
games submitted by our members
Games in WIP (466)
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
1  Game Development / Newbie & Debugging Questions / Re: Rotating a point around a center point algorithm on: 2013-10-22 22:51:11
Or like this:
To rotate a point 'p' around another point/origin 'c' simply subtract c from p, then rotate p and add c.

p.x -= c.x
p.y -= c.y

newx = p.x * cos(angle) - p.y * sin(angle)
newy = p.x * sin(angle) + p.y * cos(angle)

p.x = newx + c.x
p.y = newy + c.y
2  Java Game APIs & Engines / Engines, Libraries and Tools / Re: libGDX/Box2D on: 2013-09-16 17:41:05
I do it so that in my entity class (player for example) I have box2d's body field which gets added to world at the begining. Then in entitiy's render method you can draw anything at body.getPosition().
3  Games Center / WIP games, tools & toy projects / Re: Gravity Spy (LD27) on: 2013-08-28 12:52:26
It's part of the game yes. Sometimes you need to go into lower orbit to complete a level.
4  Game Development / Newbie & Debugging Questions / Re: Orbit ? on: 2013-08-27 23:16:36
Just make a "planet" class where you have vector for position and velocity. In update method you can iterate through other planets, calculate angle to this one and apply some speed into that direction (of course you have to keep in mind that a=m/s^2). You could also work with mass for more realistic simulations. For user's control you'd just apply some custom speed to any planet.
5  Games Center / WIP games, tools & toy projects / Re: Gravity Spy (LD27) on: 2013-08-27 13:08:22
I think you're in orbit  Grin
6  Games Center / WIP games, tools & toy projects / Re: Gravity Spy (LD27) on: 2013-08-26 16:57:06
Your own music! Cool, what tool did you use for that?
FL Studio. I was making music before I started programming, but never got really into it.

Your game would be much better if you made the lights flicker/give signal before they switch, now you can't see it coming :S
Someone on the LD page suggested this aswell and yeah it would be cool. I didn't thought of that before and some other minor tweaks.
7  Game Development / Newbie & Debugging Questions / Re: Simple Day/Night Cycle Libgdx on: 2013-08-26 12:56:57
I normally keep a float in level class for time [0, 1]. 0 would be night and 1 is day. Then I calculate the current value with a sine curve (There's probably different ways).
After that you can use this value to position the sun sprite and stuff like that. If you're using LibGDX you can use it with sprite batch as a tint color, which would make nights dark and days bright.
8  Games Center / WIP games, tools & toy projects / Gravity Spy (LD27) on: 2013-08-26 03:46:32
Phew. That was intense. Here's my LD27 entry!
I went for that stealth type game, which was not my first idea but it was an option to do something with "10 seconds" and got opportunity to play around with box2D.
Also I've made my own music for the first time Smiley
Game only uses 2 tiles, pretty cool huh?






Ludum Dare page: http://goo.gl/PbSx64
Jar: http://goo.gl/0zjX4L
Source code: http://goo.gl/xPwuXe
9  Games Center / Contests / Re: Ludum Dare 27 on: 2013-08-22 09:29:46
Totally doing this. I hope the theme will be something interesting.
10  Game Development / Newbie & Debugging Questions / Re: lighting system on: 2013-08-21 21:16:44
Take a look over here: http://www.java-gaming.org/topics/2d-dynamic-lighting/27012/view.html
11  Game Development / Newbie & Debugging Questions / Re: Tiles on: 2013-08-18 15:03:09
I always keep tiles in 1D array and draw them either with 2 for loops (accessing tileID with tiles[x+y*mapWidth]) or something like this:
(rough example)
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
int mapWidth = 2;
int mapHeight = 2;
int[] tiles = {
   1, 1
   1, 2
};

for(int i = 0; i < tiles.length; i++) {
   int x = i % mapWidth;
   int y = i / mapWidth;
   int tileID = tiles[i];
         
   draw(tileID, x, y);
}
12  Game Development / Newbie & Debugging Questions / Re: Tower Defence waves loading on: 2013-08-13 20:38:22
How about randomized spawns? Make a spawner helper class with variables like: enemy types, spawn delay, max enemies spawned etc. Logic behind that is self-explanatory and those values can vary over time and/or wave.
13  Games Center / WIP games, tools & toy projects / Re: Mega Melon Adventure on: 2013-08-06 15:35:57
Looks lovely Smiley I assume you're using applyLinearImpulse to move the melon, I'd change that to applyForce (except for jumping) to make controls smoother.
14  Games Center / WIP games, tools & toy projects / Knights & Arrows (7DRTS) on: 2013-07-30 03:20:07
An RTS style game made for MiniLD#44. Manage squads, protect your base and destroy enemies.

Controls:
"A" - Select/deselect all squads.
"LCTRL" - Invert selection.
Drag to select squads.
Hold LSHIFT while selecting to add squads to selection.
Click anywhere to open Move/Attack/Abort menu.

Each squad can contain 9 units and you can have 10 squads max.
There are 4 different unit classes:
-Bowman and magician: long ranged, lower hp.
-Monk: mid ranged, less damage, can heal other units of the same squad.
-Knight: short ranged, fast and high damage attacks.




JAR Download: http://goo.gl/kEfldM
LD Page: http://www.ludumdare.com/compo/minild-44/?action=preview&uid=10029
15  Java Game APIs & Engines / Engines, Libraries and Tools / [LibGDX]TiledMap screen tearing on: 2013-07-19 09:25:35
I found a few similar topics on this problem, but I failed to solve it. When rendering a tiled map using API from libgdx or slick2D there are awful white lines across the screen (if camera moves). I tried constraining camera position to integer values, which works but not for scaling. Pre-rendering to FBO gets rid of some artifacts but map still isn't smooth. Any ideas?
16  Game Development / Newbie & Debugging Questions / Re: Entity[] not working? on: 2013-07-13 18:34:25
To initialize an object means to do this: object = new Object()... tree = new ConstructionTree() in your case. "Object object;" is just declaring an object field.
17  Game Development / Newbie & Debugging Questions / Re: Entity[] not working? on: 2013-07-13 18:26:02
Did you initialize "tree" object?
18  Game Development / Newbie & Debugging Questions / Re: OpenGL VBO rendering vs Immediate Mode on: 2013-07-11 22:54:59
Try not to use immediate mode. If you need to update vertex data every frame look into vertex arrays. VBOs are usually used for mostly static geometry that doesn't change so often.
19  Game Development / Newbie & Debugging Questions / Re: Render methods on: 2013-07-09 16:52:25
Use the code in first paragraph, because that's how you use double buffering (triple in your case). It draws an offscreen image and then draws that image to screen, without drawing other stuff separately, which removes flickering in java2D games.
20  Game Development / Newbie & Debugging Questions / Re: LWJGL camera zooming? on: 2013-07-08 18:39:16
Mouse.getDWheel() should return negative, 0 or positive number. So just change that to -1, 0 or 1 using IF's.
21  Game Development / Newbie & Debugging Questions / Re: LWJGL camera zooming? on: 2013-07-08 18:07:59
Simple linear interpolation should do the trick:
1  
2  
3  
4  
5  
6  
7  
int wheel = Mouse.getDWheel();
if (wheel != 0) {
   targetZoom += 0.05f * wheel;
   targetZoom = clamp(targetZoom, 0.0125f, 1f); //clamp(x,min,max)
}
float t = 0.02f; //speed
camera.setZoom(camera.getZoom() + t * (targetZoom - camera.getZoom()));
22  Discussions / General Discussions / Re: Whatever happened to Euclideon's Unlimited detail? look inside to see! on: 2013-07-05 13:24:50
I hate how he keeps saying "unlimited data", which is simply impossible and silly to even mention. However, I'd like to try out a demo.
23  Game Development / Newbie & Debugging Questions / Re: How to use Tiled with Libgdx on: 2013-06-27 05:34:08
The second link you posted is the right tutorial, but libGDX 0.9.8 doesn't contain some of the classes. I don't know what is going on there, but check this out: http://www.badlogicgames.com/wordpress/?p=2870 On this post you can find github link and download the project, which contains those classes. I had to unzip the original library and add classes from com.badlogic.gdx.maps.tiled.* to get it to work. Kind of messy, but it works.
24  Games Center / Showcase / Re: Three Tiles on: 2013-04-29 17:31:35
Thanks for your comments. I fixed some bugs and added new levels today. (url is updated)
25  Games Center / Showcase / Three Tiles on: 2013-04-29 03:28:20
Hey all!
Just want to show a game I made for ludum dare. It was an awesome experience and the longest coding streak I ever did.





Download: https://dl.dropboxusercontent.com/u/31393301/LD26/threetiles_win.exe
Source: https://dl.dropboxusercontent.com/u/31393301/LD26/ThreeTiles_src.zip
LD page: http://www.ludumdare.com/compo/ludum-dare-26/?action=preview&uid=10029
26  Game Development / Newbie & Debugging Questions / Re: LWJGL Keyboard, what's going on? on: 2013-01-28 18:30:34
So I could just use the keys I need.
27  Game Development / Newbie & Debugging Questions / Re: LWJGL Keyboard, what's going on? on: 2013-01-28 18:25:53
Ah I see. Gonna implement it straight away. Thanks!
28  Game Development / Newbie & Debugging Questions / LWJGL Keyboard, what's going on? on: 2013-01-28 17:22:36
Hello!
Quick question! I have player input setup like this:
1  
2  
3  
4  
5  
boolean keyUp = Keyboard.isKeyDown(Keyboard.KEY_UP)
...
if(keyUp){
    //move code
}

And a bit later:
1  
2  
3  
4  
5  
while(Mouse.next()){
   if(Mouse.isButtonDown(0)){
      //fire button (boom boom)
  }
}

So what happens is, if player holds UP key to run and presses mouse button to fire, movement stops. In order to run again, player must press up key again, running while shooting is impossible.
Why do keys get reset that way?
29  Games Center / Cube World Projects / Re: Merging triangle faces! on: 2013-01-06 23:24:26
I don't see why you need to optimise it that much. And that will just slow down the CPU when just one block is missing from the surface.
Well it seems like a good way to increase performance, I'll stick to only face and frustrum culling for now.
30  Games Center / Cube World Projects / Merging triangle faces! on: 2013-01-06 22:56:13
Hello!  Smiley
I need some help!
So basically, having an integer array of cube ids with the size of 16^3 and static method, which returns triangle vertices based on location given by array iterator. Feeding vbo with that data I get this mess:


Nothing fancy but here's a problem I'm struggling with..
That chunk of cubes could also be rendered like this, providing that ids are the same:


Getting rid of cubes that are completely surrounded would be easy, but I still have a lot of verticies left that don't have to be stored in memory. I need someone's help on algorithm that would "merge" verticies that share the same properties and kept triangle topology. (after trying it just got far too complex)
 
Pages: [1] 2
 

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

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (80 views)
2014-04-15 18:08:23

BurntPizza (72 views)
2014-04-15 03:46:01

UprightPath (83 views)
2014-04-14 17:39:50

UprightPath (67 views)
2014-04-14 17:35:47

Porlus (83 views)
2014-04-14 15:48:38

tom_mai78101 (107 views)
2014-04-10 04:04:31

BurntPizza (167 views)
2014-04-08 23:06:04

tom_mai78101 (263 views)
2014-04-05 13:34:39

trollwarrior1 (213 views)
2014-04-04 12:06:45

CJLetsGame (222 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
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!