Jump to content

  • Log In with Google      Sign In   
  • Create Account


warnexus

Member Since 07 Jun 2012
Online Last Active Today, 09:38 AM
-----

Posts I've Made

In Topic: Why Java games do not need installation

20 July 2014 - 09:14 PM

I never thought about this until now. The Java games I developed never need the installation treatment.

That only tells me your games aren't complex enough to require an installation procedure.
 
What happens if you want someone to play your game in Windows, and want your program installed in Program Files, with a Start-> programs menu, a desktop icon, and an uninstaller, wouldn't that need a dedicated installation procedure? Regardless of your game being made in Java, C or Haskell?

I developed a rpg in Java and it could be played fine without installation.

It seems to be a minor issue in terms of time if I wanted the user to go to the start menu to find my games when it could quickly be played after downloading the game to the desktop.

In Topic: Chosen polygon for bullets in fps game

20 June 2014 - 09:23 AM

Depends on the shape and how the projectiles is traveling in a path.

The projectiles in my 2d space shooter game do well using just basic rectangles.

But as you delve into weird projectiles going a more complicated trajectory, throwing a spear in the air will need a different approach.

In Topic: How to make a character fall off the block after it has been on it

04 June 2014 - 04:04 PM

 

 

Your question kind of answers your question.

Make separate states for "initiating the jump" and "jumping" (I like to call it "falling").

if(spacePressed && (state != ActionState.JUMPING))
{
state = ActionState.JUMP;
}
else if(state == ActionState.JUMP) // .... and then in the next frame
{
state = ActionState.JUMPING;
}

 

Good approach, but easily improved. There might be more situations. Jumping, falling, climbing, swimming, and more.

 

To make it more general:

if(spacePressed && CanJump())

Then add a short function that checks if they can jump. Perhaps they must be actually on the ground, must not be burdened or stunned, or otherwise incapable of jumping.

 

And to improve it yet again, why is jumping related to space?  What if they reassigned the keys, or are using an xbox controller or a mouse to control? Translate input from buttons to events as soon as you are able.  That gives this:

if(jumpPressed && CanJump()) {...}

which makes the intent even more clear to anyone maintaining the code later.

 

spacePressed is a boolean flag that is set to true when the space key is pressed


In Topic: How to make a character fall off the block after it has been on it

04 June 2014 - 02:27 PM

Warnexus, I assume, if your player steps off a platform and is falling, he won't be able to jump while falling right?  What I'm trying to get at is, you might need a generic solution which works whether you've just jumped or you're falling.

 

I'd suggest looking at trying to use a IsOnGround flag, unless you have a special can jump in mid air ability.

I managed to fix it. I decided to write a logic that tells the game that the character is off the block. So I can do something like this:

 

if(!onBlock && getY() + idleRightAnim.getHeight() < Screen.HEIGHT - 35)
{
         if(state != ActionState.JUMPING)
         {
              state = ActionState.FALLING;
         }
}

In Topic: Do all 2D games do this?

04 June 2014 - 08:42 AM

 


I'm using Java Standard: more specifically the awt library that has Canvas and BufferStrategy and Image and BufferedImage. What do you mean by intermediary API? 

Exactly that: the AWT canvas/bufferstrategy API (as opposed to using OpenGL directly, for example).

 

Oh so I don't need to worry about efficiency then since the API is batching it up like that?


PARTNERS