Java-Gaming.org
 Featured games (91) games approved by the League of Dukes Games in Showcase (579) games submitted by our members Games in WIP (500) games currently in development
 News: Read the Java Gaming Resources, or peek at the official Java tutorials
 Show Posts Pages: [1] 2 3 ... 5
1  Discussions / General Discussions / Re: Get position of end of angle? on: 2014-04-19 04:58:13
After looking over many things, I have come to the conslusion that instead of doing "angle", I have to do "angle*side*Math.PI/180". I thank you all for pointing me in the right direction and helping me get it done.

Code that worked:
 1 armHoldPosition = new Point((int)(x*side-2 * Math.sin(armRotateAmount*side* Math.PI / 180)),(int)(y - 2 * Math.cos(armRotateAmount*side* Math.PI / 180)));
2  Discussions / General Discussions / Re: Get position of end of angle? on: 2014-04-19 03:51:57
 1  2 int x = Math.sin(armAngle);int y = Math.cos(armAngle);

how is that supposed to help.

I use x = radius * sin(angle)  y = radius * cos(angle)

its not a radius, its a distance.
 3 Discussions / General Discussions / Re: Get position of end of angle? on: 2014-04-19 00:50:22 Quote from: LiquidNitrogen on 2014-04-19 00:02:24http://stackoverflow.com/questions/19355026/move-an-object-in-the-direction-its-facing-using-2d-html5canvas-and-ctx-rotate-for just have a quick read of this  instead of moving the object *speed, move it *armLengthDoesnt work, produces very odd results, so odd its not worth sharing. Someone here has to have ton something having to do with this. I remember seeing a post by wessles some where where he got awnsers to how to find the end of his gun on his very first submission, but i cant find it. Any one else?
 4 Discussions / General Discussions / [FIXED] Get position of end of angle? on: 2014-04-18 23:45:12 Hey guys, I am once again here because I am stumped on something. In my game, I want to calculate the position of the end of the arm, if you can imagine this, I have the arm rotation angle (from the center of the body), and I have the distance of the arm. Can someone point me in the right direction or give me some pseudo code.
 5 Games Center / WIP games, tools & toy projects / Re: Project NAH - A sandbox survival platformer. on: 2014-04-18 22:35:31 I'm openly looking for game name ideas. Im thinking along the lines of bloxed, or salutem [SAL-OOT-UM] (one of the many ways of saying survival in latin).
 6 Games Center / WIP games, tools & toy projects / Project NAH - Alpha 0.1.0 on: 2014-04-18 21:37:20 The game is now named Project NAH. This isnt offical, its just the "alpha/beta" name, and may even be changed again during alpha/beta.Alpha 0.2.0 is expected to arrive soon. This is what I have so far.I've changed the inventory hotbars from 10 slots to 5, and made them centered, in addition i fixed the breaking and placing bug I was having, so as you can see I can break/place. Oh and the inventory controls fully work now, and there are maxstacks and currentstacks so you can just have unlimited stuff. However im still working on displaying strings, and may need a point in the right direction before the number shows on the slots.Blocks have health now, and a maxhealth, so double pickaxes or double axes, or if I implement multiplayer 2 people will all cause twice, triple, quadruple etc. speed. Its essentially like an entity in a game such as minecraft or terraria, if two people hit the entity, the entity takes damage from both. Because of this, blocks will retain their health which will add, or what I think, some great atmosphere to the game and the ability for me to add some (unpromised) features along with this fact.Blocks also drop items which can be picked up at the players arm length away.Oh and as you can see picks are implemented, they increase the players speed at mining stone (obviously)
 7 Game Development / Newbie & Debugging Questions / Re: [FIXED] Mouse Coords in a tiled world. on: 2014-04-16 23:27:46 Quote from: opiop65 on 2014-04-16 23:23:04Quoteit only shows a fixed amountYou mean it doesn't scale the objects in game, correct? I would highly advise against this. If someone plays in a different screen ratio, all your objects are going to look distorted. Minecraft and Terraria handle resizing the correct way by scaling, I have no idea why that would be a bad thing.I tested it on the normal ratios. They all look perfect. All I am saying is your FOV wont increase or decrease if you double or halve the resolution.
8  Game Development / Newbie & Debugging Questions / Re: [FIXED] Mouse Coords in a tiled world. on: 2014-04-16 23:18:25
Im very happy to announce it was fixed. For anyone wondering, the engine was calculating the mouse position wrong, basically as liquid said, resizing makes a difference. Well- my ortho view does not render the amount of pixels the window has, it only shows a fixed amount and thats why my windows resize so nicely (unlike terraria and minecraft, I think they dont resize as well).

Heres the code I fixed it with.

 1 actionPos =  new Point((int)((((double)GDisplay.camera.getFovX()/(double)GDisplay.getDisplaySize().width)*Mouse.getX())+GDisplay.camera.getX()),(int)((((double)GDisplay.camera.getFovY()/(double)GDisplay.getDisplaySize().height)*Mouse.getY())+GDisplay.camera.getY()));

9  Game Development / Newbie & Debugging Questions / Re: Mouse Coords in a tiled world. on: 2014-04-16 02:07:04
my program has an issue like that when the window is different size than the view port, the drawing is scaled up and down nicely, but the mouse co-ords are still relative to the physical screen resolution.
Already fixed by the engine, no matter the screen size the end will always be 1920 or 1080 depending on the axis. The engine also tries to render it at this however the field of view is  not.
 1  2  3  4 public void initCamera() {      setFOV((int)(240*1.5),(int)(135*1.5)); //lazy      glEnable(GL_TEXTURE_2D);   }
10  Game Development / Newbie & Debugging Questions / Re: Mouse Coords in a tiled world. on: 2014-04-16 02:05:30
IF you are scaling your tiles you will need to dived the x or y position by the scale amount.

Example if I am scaling by 32 I would take x/32  or y/32
Are you doing any sort of scaling when you render that you haven't accounted for when calculating your mouse/world position?

Thats figured out. I need the mouse position. Translating it to the tiles themselves works. Just for the sake of it though, these are the methods that add blocks

 1  2  3  4  5  6  7  8  9  10  11  12  13  14  15  16  17 public void setBlockAtPixel(int x, int y, Block blockFromID) {      x = x/Block.blockSize.width;      y = y/Block.blockSize.height;      final Point cpos = new Point((int)(x/Chunk.xa), (int)(y/Chunk.ya));      final Chunk chunk = chunks[cpos.x][cpos.y];      Point lpos = new Point(x%Chunk.xa, y%Chunk.ya);      setBlock(chunk.foreground, cpos.x, cpos.y, lpos.x, lpos.y, blockFromID);   }public void setBlock(Block[][] blocks,int cx, int cy, int x, int y, Block b){      final Point cpos = new Point(cx,cy);      Point lpos = new Point(x%Chunk.xa, y%Chunk.ya);      b.cpos = cpos;      b.lpos = lpos;      b.updateCoords();      blocks[lpos.x]            [lpos.y] = b;   }

11  Game Development / Newbie & Debugging Questions / [FIXED] Mouse Coords in a tiled world. on: 2014-04-16 01:23:40
Hey guys. I need some help with my platformer game, you see- I cannot figure out at all how to find where the mouse is on the screen. You may be saying:
 1 Well, just add them mouse coords and camera coords, then it will work.

but no. It doesnt. I have no clue why! Let me keep in mind, it works if I use the player's x,y I just cant add the mouse factor into that.

Since I probally havent given enough info on the code itself, you can generalize, but this is what ive tried so far.

WORKS.
 1 actionPos =  new Point(x,y);

DOESNT WORK. WELL, SORT OF
 1 actionPos =  new Point(mouse.x+camera.x,mouse.y+camera.y); //camera is just the players x and y with half the screen subtracted

Any suggestions? Now here is the silly thing. It works, but the action position races ahead of the cursor. Basically at 0,0 on the screen, where camera.x, camera.y is, it is 100% accurate, but 2 pixels away, it may be 4-6 pixels away, at about half the screen its a quarter screen away from the cursor, etc.

I hope you guys can help. Ill give any more stuff on the issue if its needed! This is urgent!
 12 Games Center / WIP games, tools & toy projects / Re: Platformer - SAGL 1.0 on: 2014-04-15 00:23:13 Quote from: Coldstream24 on 2014-04-15 00:22:32That's an interesting concept you've got there.Hopefully I can make it work, I have never seen it in a game and if I do it right I think it will be golden. Anyone agree?
 13 Games Center / WIP games, tools & toy projects / Re: Platformer - SAGL 1.0 on: 2014-04-15 00:17:48 Inventory is on the way! As you see I have a stone block in my inv, however the amount you have, and the ability to break/place is still in development, for now, heres some spoilers on the inventory.What your seeing is a double hotbar, completely independant inventories, which will be used for the 2 hand tool systeme.g. in combat having a shield that gives defence bonus in your front hand and a short sword in the rearThe inventories can be controlled together, and independently very easily with simple key/mouse buttons/strokes. Thats all I will say for now  Oh and that world was generated in less than a few seconds. Its 12x12x16x16 blocks.
 14 Games Center / WIP games, tools & toy projects / Re: Gold Miner! on: 2014-04-14 23:26:25 [derail]Now i'm sure to be flamed for this, or perhaps get a shiny metal, but I need to tell you something that will keep you better off. Now you don't have to listen to me, thats fine. (but a lesson in a lesson, listening to all will help you in the long run).First and foremost, On the behalf of what I've seen, no one looks up to game devs who don't make games that they like.  What you need to do first is CREATE an ENTIRE game, and then start trying to show themselves as a person. What I mean by this is, make a product, then you'll be known for it. If someone suddenly said "I'M GOING TO CREATE THE BEST GAME EVER" no one will care, or they will say, do it. But if someone creates a great game, the person will then be known, take notch or redigit for example, they were just doing there own thing, people loved their games, and thus they became well known people. But have you ever heard of the guy who said they were going to create a game and get instant famous (without having made a previous product). No. you havent.In summaryMAKE STUFF ==> GET FAMOUSGET FAMOUS =/=> MAKE STUFFor if it floats your boatBE MILEY CYRUS ==> GET INFAMOUSI personally dont like el little kids who act famous. *coughicoughtrycoughnotcoughtocoughbecoughone*FAQQ. Swords, Why do you always b so mean.A. Because im harsh.Q. Why are you flaming/derailingA. Because Devin is pretending he is famous and everyone cares about his weebly.com websites. and quite frankly, thats very unprofessional in my mind...Quote from: xXCoderDevinXx on 2014-04-14 21:54:12Ok we have a new website!New Website:http://welkigames.weebly.com Be sure to check for updates on there I took a little vacation from working on Gold Miner but production should be back up on Wednesday or Thursday!- DevinI don't need any flamers, I'm just inputting my opinion, it stops here.[/derail]
 15 Discussions / General Discussions / Re: What genre/artists do you listen to while coding? on: 2014-04-13 23:20:49 Things from the terraria and minecraft albums.I ussually listen to boss 1, boss 2, or droopy likes richochet (or your face).
 16 Discussions / Business and Project Discussions / Sound/Music Artists. on: 2014-04-09 15:10:55 The game I am currently working on is coming along nicely, my "team" and I would love to know people who are good at creating music and sounds so when we have a game worthy of it we know who to call. Thanks! If you need more info just ask.  (this man swords cant be artist, dev, and music artist ok? im not notch or red or anything)
 17 Games Center / WIP games, tools & toy projects / Re: Platformer - SAGL 1.0 on: 2014-04-05 00:12:08 I have worked on many ideas, have a lot of them in XMind, and have implemented a few. I got custom skin color and eyes down, collision down, and I just got loading and saving done.Unlike Super Doctor Who and SAGL's native way to save and load, I made a new way. I made a  binary based saving loading system based off of Notch's NBT, the format used to save and load minecraft. I also kind of based the chunk format off of his own too.It works like this, it creates a binary for the chunk, inside that there are binaries for its position, and a compound binary full of blocks, the blocks are named by x and y and inside of them they have binaries for their respective x, y, and id (yes, no longer basing it off of class names, blocks have ids)Here is a gif of it in action, I saved the map on the first windows, and when I jumped on the second I loaded it, notice how the maps are the same.The game still has the super doctor who icon I hope you guys enjoy my advances in the game and the coding world.
 18 Games Center / WIP games, tools & toy projects / Re: MERCury - 2d Game Engine on: 2014-04-01 15:04:59 Quote from: wessles on 2014-04-01 04:42:15-snip--wes  *Pinch nose* *Lowers nasal cavity* "Hay goys, weslwlsss heare"
 19 Games Center / WIP games, tools & toy projects / Re: Platformer - SAGL 1.0 on: 2014-04-01 15:01:46 Ive pushed 0.1.1 to github, however there will be no demo since its only a minor patch, what I had did that made the collision wacky is instead of saying "If there is a block at the head or feet" I said "If there is a block at the head and feet", which you can see how that would mess it up tons.
 20 Game Development / Newbie & Debugging Questions / Re: [UNSOLVED] Collision Trouble on: 2014-03-30 22:31:16 I cant seem to find a solution
21  Game Development / Newbie & Debugging Questions / [UNSOLVED] Collision Trouble on: 2014-03-30 15:20:54
Hey guys. I need your help for my SAGL Platformer, I am using the same, working code from Super Doctor Who but in this run it seems to not be running for some reason.

First off, I check sideways collision using this:

 1  2  3  4  5  6  7  8  9  10  11  12  13  14  15  16  17 protected boolean collidingWithWallRight(){      if(!collidable)         return false;      return game.chunkManager.isBlockAtPixelCollidable(x+(width/2)-1,y+(height))  && game.chunkManager.isBlockAtPixelCollidable(x+(width/2)-1,y-(height/2)) ;   }   protected boolean collidingWithWallLeft(){      if(!collidable)         return false;      return game.chunkManager.isBlockAtPixelCollidable(x-(width/2),y-(height))  && game.chunkManager.isBlockAtPixelCollidable(x-(width/2),y+(height/2)) ;   }   protected boolean collidingWithWall() {      if(!collidable)         return false;      return game.chunkManager.isBlockAtPixelCollidable(x-(width/2)+4,y-(height))  && game.chunkManager.isBlockAtPixelCollidable(x-(width)+4,y+(height/2)) || game.chunkManager.isBlockAtPixelCollidable(x+(width/2)-4,y-(height/2))  && game.chunkManager.isBlockAtPixelCollidable(x+(width/2)-4,y+(height/2)) ;   }

and I get the blocks and if there where they should or shouldnt be by:

 1  2  3  4  5  6  7  8  9  10  11  12  13  14  15  16  17  18  19  20  21  22 public Block getBlockAtPixel(int x, int y) {      try{         x = x/Block.blockSize.width;         y = y/Block.blockSize.height;         final Point cpos = new Point((int)(x/Chunk.xa), (int)(y/Chunk.ya));         final Chunk chunk = chunks[cpos.x][cpos.y];         Point lpos = new Point(x%Chunk.xa, y%Chunk.ya);         return chunk.blocks[lpos.x][lpos.y];      } catch(Exception e){         return null;      }   }   public Boolean blockAtPixelExists(int x, int y){      return getBlockAtPixel(x,y) != null;   }   public Boolean isBlockAtPixelCollidable(int x, int y) {      if(blockAtPixelExists(x,y))         return getBlockAtPixel(x,y).isCollidable();      return false;   }

and then in the entity's tick I call this to make sure they stay out of walls if they get into one:

 1  2  3  4  5  6 if(collidingWithWallRight()){         x-=1;      }       if(collidingWithWallLeft()){         x+=1;      }

and in the Players class I call this to move the player:

 1  2  3  4  5 if(KeyManager.keyPressed(Key.LEFT) && !collidingWithWall() && !collidingWithWallLeft()){         walk(-walkSpeed);      } else if(KeyManager.keyPressed(Key.RIGHT) && !collidingWithWall() && !collidingWithWallRight()){         walk(walkSpeed);      }

The walk method contains no collision detection.

Its so weird. I can sometimes walk through walls and sometimes I get stuck and sometimes I cant walk through walls. I can never walk through walls that are 2 blocks high, otherwise I can most of the time.

Anyone see something odd and can point me in the correct direction?
 22 Games Center / WIP games, tools & toy projects / Re: Platformer - SAGL 1.0 on: 2014-03-15 04:33:08 Quote from: LiquidNitrogen on 2014-03-15 04:30:44The game resizes nicely when I resize the window. Its quite slow ~15fps. When I click the X to close the window it kinda stalls and does nothing.I get a solid 60 fps on the game, but thats probably because I have a really nice computer (not saying yours isn't). I will look into optimizing more of it to make it faster. May I ask did the game not stop at all? Or did it take a few seconds for it to stop.
24  Discussions / General Discussions / Re: Ever forget how your own code works? on: 2014-03-12 21:51:58

My pet peeves:
• Magic Numbers* are the silent enemy, exterminate them with extreme prejudice.

 1  2  3  4  5  6  7  8  9  10 /** Easy as PI */public static final double PI = 3.1416d;/**Method Documentation: The formula is "2 * PI * RADIUS^2" *@param Radius A parameter being documented *@returns Return value also being documented */public double Perimeter(double Radius){   return 2.0d * PI * (Radius * Radius);}

Math.PI?!?!
 25 Discussions / General Discussions / Re: just Learned Interfaces on: 2014-03-12 04:12:34 I never learned anything about interfaces besides that I use them like classes, because I use runnable right? and thats an interface. But can someone clarify for me what an interface is and what it is ussually used for, and how is it different than a class.
 26 Game Development / Newbie & Debugging Questions / Re: New on java game developing! on: 2014-03-12 04:07:03 Quote from: HeroesGraveDev on 2014-03-12 01:56:09Quote from: SwordsMiner on 2014-03-11 23:58:26Honestly, I think you should just make some time, pull up a chair and start making games.QuoteSo in conclusion, I *personally* think you should not rush in making gamesWhat?                                               Screw me. I shouldve read what I wrote.
 27 Games Center / Contests / Re: [1HJJ] IRC Chat Simulator 2014 on: 2014-03-12 00:05:35 I didn't see my username. Im sad now.    You only get half a kudos due to that. But it was funny nonetheless.
 28 Game Development / Newbie & Debugging Questions / Re: New on java game developing! on: 2014-03-11 23:58:26 Honestly, I think you should just make some time, pull up a chair and start learning java. (the first thing I made in java was a green background and a few squares), After one game is finished, make a more advanced one, and once you understand everything apart of java and java2d move to lwjgl and possible libgdx. It honestly took me 2 years of learning general programming (learned lua for roblox ), 1 year of getting framiliar with making games in general (used unity), and then I additionally started making minecraft mods and then I started on minecraft mods.So in conclusion, I *personally* think you should not rush in making games, as previously mentioned, or you'll end up rage quitting in the end like I have many times.
 29 Discussions / Miscellaneous Topics / Re: What's your rig? on: 2014-03-10 22:54:19 This is my gaming setup and development setup. And yes, there is two computers there.  . Take my word their both fantastic PCs. (16 gb ram on my gamer plus 4 gb on my graphics card, i5 cpu, 1 terabyte hd and a 250 gb ssd, and I dont bother to know what my old one has.)The one with the eclipse,  (the two far right monitors) are my gamer pc, the other is just my old, windows vista pc I use for looking at the forums.I also have a lovely razer keyboard, blue yeti microphone, logitech wireless mouse, afterglow wireless headset (the really nice, expensive of the afterglow series), and behind my speakers and out of view is my 5.1 surround sound system,I also have a external wireless adapter thats so big and strong that when I had it on top of my bass it created feedback from signals [hint] (if your able to read that code, your going to see my lovely new SAGL 1.1 source  ) [/hint]
 30 Games Center / WIP games, tools & toy projects / Re: Platformer - SAGL 1.0 on: 2014-03-10 13:59:00 I'm asking further discussion is on topic.While i'm at it, Ill let you guys know once the player is fully implemented ill give out a 0.0.1 alpha demo for everyone. However collisions need a lot of work due to the new chunk system I added in.
 Pages: [1] 2 3 ... 5
 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 (37 views) 2014-04-15 18:08:23 BurntPizza (33 views) 2014-04-15 03:46:01 UprightPath (49 views) 2014-04-14 17:39:50 UprightPath (31 views) 2014-04-14 17:35:47 Porlus (48 views) 2014-04-14 15:48:38 tom_mai78101 (69 views) 2014-04-10 04:04:31 BurntPizza (129 views) 2014-04-08 23:06:04 tom_mai78101 (229 views) 2014-04-05 13:34:39 trollwarrior1 (193 views) 2014-04-04 12:06:45 CJLetsGame (200 views) 2014-04-01 02:16:10
 princec 32x Riven 24x Rayvolution 20x Gibbo3771 15x saucymeatman 12x Roquen 12x theagentd 11x BurntPizza 11x ctomni231 11x trollwarrior1 10x matheus23 10x HeroesGraveDev 9x Longarmx 8x JFixby 8x opiop65 7x kpars 7x
 List of Learning Resourcesby SHC2014-04-18 03:17:39List of Learning Resourcesby Longarmx2014-04-08 03:14:44Good Examples2014-04-05 13:51:37Good Examplesby Grunnt2014-04-03 15:48:46Good Examplesby Grunnt2014-04-03 15:48:37Good Examples2014-04-01 18:40:51Good Examples2014-04-01 18:40:34Anonymous/Local/Inner class gotchasby Roquen2014-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