Java-Gaming.org Hi !
Featured games (84)
games approved by the League of Dukes
Games in Showcase (564)
Games in Android Showcase (151)
games submitted by our members
Games in WIP (605)
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 ... 38
1  Game Development / Newbie & Debugging Questions / Re: [Unsolved] Bullet not shooting in correct direction! on: 2015-03-26 19:17:24
To note, you have to Negate the result of the subtraction.

1  
-originY -  targetY


This is different from :

1  
-(originY - targetY) 
2  Game Development / Newbie & Debugging Questions / Re: [Unsolved] Bullet not shooting in correct direction! on: 2015-03-26 18:40:02
Doing Origin - Target makes them look in opposite directions.

Negate it.

1  
MathUtils.atan2(-(originY - targetY),  - (originX -  targetX));


When doing cos and sin, you multiply it by a scalar.

1  
2  
velocityX = MathUtils.cos(angle)  * speed
velocity  MathUtils.sin(angle)  * speed


Ensure speed (or whatever you call it) remain the same during both multiplications.

You also need to learn to use vectors to encapsulate your data.

You can literally half your members, they also have really nice functions.
3  Game Development / Newbie & Debugging Questions / Re: [Unsolved] Bullet not shooting in correct direction! on: 2015-03-26 18:18:08
Ensure you are doing atan2 the correct way. Origin -  target, not the other way around.

Also ensure that you are multiplying the cos and sin by the same value.

If atan2 is not working (for whatever reason), use vectors. Get dst, square it and normalise (this could be completely wrong, tired as shit).
4  Game Development / Newbie & Debugging Questions / Re: OSX 10.10 seems to have broken my games on: 2015-03-26 10:43:31
This must be a problem across many different sdks/languages, as Marmalade (c++ game library) are reporting strange issues on osx beta.

From email :

"Please note that we have detected a compatibility issue with latest beta version of OS X (10.10.3 beta).
 
Specifically, the licensing component of Marmalade is incompatible with the latest OS X update. The impact of this issue is severe: Marmalade licenses cannot be activated or verified. As a result of this it is not possible to perform any builds or deployments
".

Coincidence?
5  Game Development / Newbie & Debugging Questions / Re: Best tutorials on the basics? on: 2015-03-24 11:20:53
Short and sweet.
6  Game Development / Game Play & Game Design / Re: Best Approach at HUD and Fonts on: 2015-03-23 11:27:19
Also for the record you should have a camera for the UI on its own.
7  Discussions / Miscellaneous Topics / Re: What Anti-Virus are you using? on: 2015-03-22 09:16:02
None.

Not used Anti-virus in 5+ years, it's funny that I only ever get virus' and slowdowns when anti-virus software flags it.

Also, I use private torrents as well so it's pretty much impossible to get a virus, it's ridiculously well moderated. Also stick to Pornhub as well :p.
8  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-03-21 17:56:13
Booked moto-cross lessons for the 4th of July, can't wait.

After a decade of mountain biking I am finally going to try it "with an engine" as all my non mountain biking friends claim it to be. Little concerned as I have only ridden a 125cc bike once, and this guy is confident that I will be fine on a 450cc bike right off the bat given my experience on a downhill mountain bike. One way to find out :p.

I'll be taking my GoPro so will try and get a video, probably of me having a complete whip out.
9  Java Game APIs & Engines / Engines, Libraries and Tools / Re: EGit and libGDX on: 2015-03-21 17:45:51
Now how do I mark this as solved...?

Edit your thread title with [solved] at the start.

You can also use other tags, like [libgdx] as well Cheesy.
10  Java Game APIs & Engines / Engines, Libraries and Tools / Re: EGit and libGDX on: 2015-03-21 08:15:18
Just create a repo for the folder that contains all 3 projects and you're good to go.

I recommend you look into how the git ignore file is configured and ignore the bin / assets folder of you want to keep the repo small.
11  Game Development / Newbie & Debugging Questions / Re: Mouse Position in Zoomed Tile Map on: 2015-03-20 09:03:41
If you don't feel like helping, just don't respond.

Oh I'll help, what I won't do is write it for you, which is what you're basically asking.
12  Game Development / Newbie & Debugging Questions / Re: Mouse Position in Zoomed Tile Map on: 2015-03-19 18:11:39

Please supply a simple code example of getting the correct coordinates based on the tile map.

Thanks

No, read my reply here to find out why .
13  Game Development / Newbie & Debugging Questions / Re: [LibGDX]Entity Framework and Input - Best approach? on: 2015-03-18 19:51:05
This is sort of what I have at the moment.

I am using components to swap states about, what I have at the moment is you press the space key and if the entity has a GroundedComponent, it gives the entity a JumpComponent, the JumpSystem then uses data from that component to propel the entity upwards, then removes the GroundedComponent, the JumpComponent and adds an AirborneComponent.

All this is fine and dandy, but you can't really poll for input from Scene2D like I am doing now. Say you press left, change the data in the VelocityComponent, which is then handled by the MotorSystem.

However, if you know what Scene2D is like, it has every button you add to the stage take a callback. I don't want to have to make a ton of anonymous classes in a system (the button shouldn't even be in the system for a starter).

So Scene2D has no knowledge of any of the components of an entity, I think I may be missing something simple here :S.

14  Game Development / Newbie & Debugging Questions / [LibGDX]Entity Framework and Input - Best approach? on: 2015-03-18 14:05:24
So I have been re-working a project that has been on the back-burner since November and decided to go with an Entity Framework for a nice and maintainable code.

The entity system I am using is Ashley and it is optional when creating a LibGDX project. Just as well, as I was going to go with Artemis until I seen this  Tongue.

I am at the stage now where I want to take input and process the player with it, however I am not quite sure how to do this, from a design perspective.

I have a system for the player, which will handle the management of states by swapping components about (as I read, this is the best way to handle states). I am not quite sure how do handle input.

I could easily add a bunch of if blocks and constantly poll input, however the input will be received using the UI (Scene2D).

What is the best approach to this? Any ideas?
15  Game Development / Game Mechanics / Re: Orbital mechanics = Keplers! on: 2015-03-18 12:01:47
You're famous for 1 liners. You are either a very good wingman or a very bad one.
16  Discussions / Community & Volunteer Projects / Re: Starting a team (Music Composer, Developer, 3d designer, and writer needed) on: 2015-03-18 11:51:52
I am done replying to these stupid comments.
You are either trying to blind yourself so you can leave a meaningless comment, Or are just stupid and cannot read and understand basic English.

The only stupid comments in this thread are your ones.

The only insults in here are the ones you're typing.

Less of your shite.
17  Game Development / Game Mechanics / Re: Push objects when walking into them on: 2015-03-17 07:36:25
Can you please learn to Google things, or at least right am informative post?

Almost every post you are asking "how to do xyz"  without any other information.

What have you tried? What do you have? Does what you have work but behave incorrectly?

This is a community for help, I get that. But hand holding is something else.
18  Discussions / Miscellaneous Topics / Re: Yay, free games! Zero's Game Giveaway on: 2015-03-16 23:01:00
It's not been 24-48 hours yet has it? I want that as well :p.
19  Game Development / Newbie & Debugging Questions / Re: Libgdx I can't find glScalef method in GL on: 2015-03-16 22:58:37
Are those not OpenGL 1.x functions?

I think now you just scale by a matrix yourself.

EDIT: LibGDX only supports OpenGL 3.0 now.
20  Discussions / Community & Volunteer Projects / Re: Starting a team (Music Composer, Developer, 3d designer, and writer needed) on: 2015-03-16 22:55:01
Also it comes across quite bad when you come in and state you want:

Music guy, a coding guy, a designer and a writer.

You basically just said, "hey guys, I have this project I started, come finish it for me". Although this is not what you intended, its interpreted this way by many.

But yeah, these types of posts have been beaten to death Sad.

-You must be at least 18 years old. (If you want to get a share of game profits).

Boo! Hiss! Hate!
Some of the 12 year olds on this forum can do everything you just listed.
Thats the only part I would have to defend here.
I wouldn't personally work with someone who isn't at least 19 years old.
And also he says: if you want share of game profits. Thats law. Gotta be 18.

Agreed. Personally I have always had issues with < 18 year olds, it's usually bad work ethic or random disappearances. This ruins it for the ones that do want to work hard, but heh, aw well. Life sucks, deal with it.
21  Game Development / Newbie & Debugging Questions / Re: Matrix Transformations on: 2015-03-16 21:37:05
I fixed this problem, let me update the OP with the solution.

@Longor1996 I am using LibGDX, apologies forgot to tag.
22  Game Development / Newbie & Debugging Questions / Matrix Transformations on: 2015-03-16 16:01:38
So I am having a little trouble trying to get used to using matrices for scaling, rotation and translation in 2D space.

Usually I can just open the source and have a look over the code and see how it works, however given my limited knowledge of matrices (I am learning, slowly), then the code looks like complete gibberish!

So the problem:

I have my Box2D body and a fixture attached, since a lot of things will be dependent on the position of the body, such as Sprites or particles, I am copying the data of the body to a Transform class. The class looks like this. Now call me out straight away if something does not look right:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
public class TransformComponent extends Component {
   public Matrix4 transform = new Matrix4();
   public Matrix4 scale = new Matrix4();
   public Matrix4 rotation = new Matrix4();
   public Matrix4 translation = new Matrix4();
   
   public TransformComponent(Vector2 position, float angle) {
      translation.setTranslation(position.x, position.y, 0);
      rotation.setToRotationRad(new Vector3(position.x, position.y, 1), angle);
      scale.setToScaling(new Vector3(1, 1, 1));
      transform = scale.mul(scale).mul(rotation).mul(translation);
   }
}


So I create each matrix and multiply them to get the final transform. Is this correct? If so, then onto the actual problem.

Here is the code that updates the entities transform component with that of the body:

1  
2  
3  
4  
5  
6  
TransformComponent t;
PhysicsComponent p;
t.rotation.setToRotationRad(new Vector3(p.getBody().getPosition().x, p.getBody().getPosition().y, 1), p.getBody().getAngle());
t.scale.setToScaling(1, 1, 1);
t.translation.setToTranslation(p.getBody().getPosition().x, p.getBody().getPosition().y, 1);
t.transform = t.rotation.mul(t.scale).mul(t.rotation).mul(t.translation);


This is called every frame, after the physics step and before drawing.

Here is the fantastic drawing code that you have probably seen a million times:

1  
2  
3  
4  
5  
         DrawableComponent d;
         TransformComponent t;
         SizeComponent s;
         batch.draw(d.getSprite(), t.getTranslation().x, t.getTranslation().y, d.getSprite().getWidth() / 2, d.getSprite().getHeight() / 2, s.getWidth(), s
                     .getHeight(), t.transform.getScaleX(), t.transform.getScaleY(), t.transform.getRotation(new Quaternion()).x);


First:

It does not rotate, the fixture hits the ground which is at an angle and rolls over, the sprite stays straight up.

Second:

The scaling does not work, at all. Any value other than 1 in any of the components of the vector results in nothing showing up.

Can someone kindly point me in the right direction for this? How can I achieve what I require? Knowing how to do this will really open my mind from the mathematics perspective, it will give me a good boost getting this working! Cheesy.

Cheers.

EDIT: Fixed multiply order

EDIT: Just realised that setRotationRad actually rotates around the point, not changing the angle. Fail.

EDIT: No idea why I though this was a good idea scale.mul(scale) but heh, not the problem anyway Sad.

EDIT SOLUTION/DIFFERENT APPROACH:

So I got a little tired messing around with this and decided to see if LibGDX's SpriteBatch had a method that allowed me to directly pass in a Transform matrix and have it handle it all internally. Turns out it does not, however it has this nice little class called Affine2, which is a 3x3 Matrix.

So I changed my Transform class to this instead:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
public class TransformComponent extends Component {
   public Affine2 transform = new Affine2();
   
   public TransformComponent(Vector2 position, float degrees) {
      updateTransform(position, degrees, new Vector2(1, 1));
   }
   
   public void updateTransform(Vector2 position, float radians, Vector2 scale){
      transform.setToTrnRotRadScl(position, radians, scale);
   }
   

}


Then I can just call the batches method like so:

1  
batch.draw(d.getSprite(), s.getWidth(), s.getHeight(), t.transform);


Nice and simple. However, there is one issue.

Affine2 has 2 different methods for doing this.

1  
2  
Affine.setToTrnRotScl(Vector2, float, Vector2)
Affine2.setToTrnRotRadScl(Vector2, float, Vector2)


The one with Rad between Rot and Scl takes radians as an argument, while the other takes degrees. I tried the degrees one first and converted by Box2D body angle using:

1  
body.getAngle() * MathUtils.radDeg


This just didn't work, the source code looks fine to me but this causes some weird scaling issue. The sprite scales up as it gets away from the world origin. Even although it works fine for the radians method.
23  Discussions / Miscellaneous Topics / Re: wrapper like library similar to libGdx for regular Apps? on: 2015-03-16 14:34:41
Most (if not all) platform independent application frameworks/sdks use css3/hmtl5/js.

Well if yes if by 'platform independent' you mean 'in browser'...  Pointing
JS on desktop is a fairly recent development. (and somewhat terrible IMO)

MP desktop apps are usually C/C++, but then most apps period are.

Whoops, meant device independent. As in Android/iOS. Pretty sure the majority of them use CSS, HTML5 and JS for creating the app, which is then compiled to the native code of the device.
24  Discussions / Miscellaneous Topics / Re: wrapper like library similar to libGdx for regular Apps? on: 2015-03-16 06:07:40
Most (if not all) platform independent application frameworks/sdks use css3/hmtl5/js.
25  Games Center / Showcase / Re: [ANDROID][LIBGDX]Crab Crusher on: 2015-03-15 12:19:54
Offtopic: Twitter and Facebook integration is ultimately the demise of Twitter and Facebook: too much nonsense and plugging, causing an exodus as we speak.

I could not care for the state of Facebook or Twitter, as I don't use them for personal use. If it can promote a product, I don't care of the effect it has.

However, the API's for both are utterly horrid (at least I thought so anyway).
26  Games Center / Showcase / Re: [ANDROID][LIBGDX]Crab Crusher on: 2015-03-15 09:11:49
This game has the potential to explode on the market. Don't leave it how it is. Keep the original and expand on it.

It looks nice, it's simple. Keep out this way but here are some things you can do to improve it.

  • Crabs need an animation, like zoidberg
  • Integration of Facebook or Twitter for sharing highscores will pretty much sell the game for you (a hassle but worth it, do this last)
  • Add some seagulls or something in the sky for the background, will look even more polished.
  • After hitting retry, display a "Tap to start" dialogue again similar to the start to play whether the app is first launched

Do it. See how it goes, you will also learn some new things as well.
27  Discussions / Miscellaneous Topics / Re: Lambda - Java 7 Alternatives on: 2015-03-14 18:36:04
Why can you not use Java 8 and make your life easier? Smiley

Probably should have mentioned in op that the project is on Android, which of course only supports java 6/7.
28  Discussions / Miscellaneous Topics / Re: Lambda - Java 7 Alternatives on: 2015-03-14 14:07:04
There is this project called as RetroLambda, it works by taking the compiled Java 8 bytecode and generating Java 7 bytecode as the output. It supports the lambdas and method references but doesn't support other features like streams API.

That. Is. Awesome.

Very clever, I will give it a shot and see if there is any problems. The project is on android so that will be my first test, just to be safe.

On the git page, the author states that if they release a Java 8 version that no longer creates a new class for every dynamic invocation, it could bust the whole thing. That's a bit of a worry if you are developing for desktop, as most people have Java on auto-update.
29  Discussions / Miscellaneous Topics / Lambda - Java 7 Alternatives on: 2015-03-14 13:35:04
So I have been coding in C# for the past 6 month and I want to go back and finish (update probably a better word) a project that has been in the backburner since November, however I was in the middle of a re-factoring of code so I could introduce new features.

Quite a lot of this code was the UI, I wanted a clean way in triggering events and well, if I Java 7 had delegates or lamdas I could easily pass said function to the UI element in question and have it invoke the method upon press. However, of course you can't do this in Java 7 or below Sad.

What are your handy alternatives to this problem? Anonymous interfaces seem like the only way to sort of do what you require.

Like I could do this:

1  
2  
3  
4  
5  
public interface IEntityAction{

    void execute();

}


Then pass it to a button like so:

1  
2  
3  
4  
5  
6  
7  
Button moveLeft = new Button(position, new IEntityAction{

    public void execute(){
        // Change state here
    }

});


That looks just...horrible.

As you know with C# you could easily just do:

1  
2  
3  
4  
5  
6  
7  
Button moveLeft = new Button(position, player.MoveLeft);

// Then in button
public void OnClick()
{
    action.Invoke();
}


Any ideas? I would be interested to know how you guys deal with this. I never really knew what Lambdas and Delegates were intil I used C#, I am finding it very hard to think of solutions to prevent a huge amount of cross talk between unrelated classes, although it does not matter to have calls to the player instance in the UI, no one likes it :p.

EDIT:

If you are wondering why I am a little anal about the cleanlinesses of the code is due to this project being developed and updated in the long run, I also won't be the the only person implementing said updates, I might not even be working with the project any more. The last thing I want to do is dump the poor sap with an absolutely horrible source.
30  Game Development / Newbie & Debugging Questions / Re: Really strange bug with collision on: 2015-03-13 21:30:16
You really think you know more about my code then me?

If Im saying that I didnt change anything in my code and only reinstall Java,that is because is what I did!

I also dont think this is a bug,what propably happened was something during my previous installation went wrong.

To prove this is true,I had my first code I posted in the forum in a pen drive,in other words: No changes!
After I reinstall Java and see that worked with the actual code that I was messing around,I also tested with the initial code I've posted here and it also works.


Up for debate on that one.

You must have changed something.

Impossible.

Something must be different, like others have said, Java does not just have random bugs like you are stating. If so, lots of server backends would be completely f**ked.

EDIT:

Just so you know, IDE's have brain farts, so I could believe that was the issue. Like sometimes my eclipse just gives up on imports and is like "nope, doesn't exit mate", when I clearly have the class open. Right. In. Front. Of. Me.
Pages: [1] 2 3 ... 38
 
wxwsk8er (51 views)
2015-03-20 15:39:46

Fairy Tailz (42 views)
2015-03-15 21:52:20

Olo (28 views)
2015-03-13 17:51:59

Olo (30 views)
2015-03-13 17:50:51

Olo (33 views)
2015-03-13 17:50:16

Olo (40 views)
2015-03-13 17:47:07

ClaasJG (29 views)
2015-03-10 11:36:42

ClaasJG (37 views)
2015-03-10 11:33:01

Pippogeek (45 views)
2015-03-05 14:36:23

Pippogeek (37 views)
2015-03-05 13:56:12
How to: JGO Wiki
by Mac70
2015-02-17 20:56:16

2D Dynamic Lighting
by ThePixelPony
2015-01-01 20:25:42

How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21

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