Java-Gaming.org
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
Featured games (78)
games approved by the League of Dukes
Games in Showcase (416)
games submitted by our members
Games in WIP (306)
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: Flipped image doesn't rotate on: 2013-06-12 15:14:33
I've commented the flipped image because it didn't work. Wink But I've tested it without comment and it doesn't work. It renders but with no rotation.
2  Game Development / Newbie & Debugging Questions / Flipped image doesn't rotate on: 2013-06-10 18:53:46
Hello and today my question is why if I flip an image, this doesn't rotate? How can I rotate a flipped image?

Flipped image, it doesnt' rotate.
1  
2  
3  
image.setRotation((float)angle);
flipped = flip;
//image.getFlippedCopy(flip, false).draw(position.getX() - camera.getX(), position.getY() - camera.getY(), scale);


Not flipped image, it rotates perfectly
1  
2  
3  
image.setRotation((float)angle);
flipped = flip;
image.draw(position.getX() - camera.getX(), position.getY() - camera.getY(), scale);
3  Game Development / Newbie & Debugging Questions / Re: Horizontal collisions on: 2013-06-10 18:50:53
Thanks you very much Smiley It's solved
4  Game Development / Newbie & Debugging Questions / Re: Horizontal collisions on: 2013-06-10 15:22:13
Sorry for my explanation. Smiley Really what I want to do is "separating both collisions". I wanna say, don't mix the vertical collision with the horizontal collision. Actually they're mixed and it's very strange because every time I'm near a wall the code says "eh you're together a block then you must be on the top of this block". I don't want that the player go to the top of the tile when the player is together a wall :S
I hope you understand better this explanation.
My collision code:
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  
public class Collision {
   
   public Collision () {
     
   }
   
   public void Update(Camera camera, Player player, Level level) {
      for (int i = 0; i < level.getMap().length; i++) {
         for (int j = 0; j < level.getMap()[i].length; j++) {
            if (level.getMap()[i][j] != 0)
               Check(i, j, camera, player, level);
         }
      }
   }
   
   private void Check(int i, int j, Camera camera, Player player, Level level) {
      if (player.getPosition().getX() - camera.getX() > i * level.getBlockSize() + level.getBlockSize() - camera.getX() ||
            player.getPosition().getY() - camera.getY() > j * level.getBlockSize() + level.getBlockSize() - camera.getY() ||
            player.getPosition().getX() - camera.getX() + player.getPosition().getWidth() * player.getScale() < i * level.getBlockSize() - camera.getX() ||
            player.getPosition().getY() - camera.getY() + player.getPosition().getHeight() * player.getScale() < j * level.getBlockSize() - camera.getY()) {
      } else {
         player.onFloor(j * level.getBlockSize(), camera);
      }
   }
}


OnFloor(player functon)
1  
2  
3  
4  
5  
6  
public void onFloor(float j, Camera camera) {
      jump = ((position.getY() + position.getHeight() * scale) - camera.getY() >= j - camera.getY());
      if (jump) {
         position.setY((j-camera.getY())  - (position.getHeight() * scale - camera.getY()));
      }
   }


Thanks you very much @relminator for the link but I saw your post before I asked this and I didn't understand it so well :S Anyway thanks you Cheesy
5  Game Development / Newbie & Debugging Questions / Horizontal collisions on: 2013-06-09 22:35:58
Hello guys I don't know how to check horizontal collisions on a tile map Cry I can check vertical collisions and they works perfectly but I don't know how to check horizontal ways. My problem is if the player is near the "tile" horizontal collision works but the player is teleported to the top of the tile. :S It's a platform game and I hope you understand what I mean
6  Game Development / Newbie & Debugging Questions / Re: Rotate player in relation to mouse position on: 2013-04-15 19:44:21
I don't know what is its function, I just was testing Smiley. And Now I've a problem with that line, I deleted it and now The line doesn't rotate..
7  Game Development / Newbie & Debugging Questions / Re: Rotate player in relation to mouse position on: 2013-04-15 18:03:06
Okay I've recorded a little video
http://screencast-o-matic.com/watch/cIfoDeV3gM

So I hope this is helpful

P.S. Sorry for the video poor quality, That's a bad webpage but I didn't want to upload the problem to youtube. And on my PC, the rotation is faster...
8  Game Development / Newbie & Debugging Questions / Re: Rotate player in relation to mouse position on: 2013-04-14 16:58:50
Guys, I don't know if you didn't understand me or I don't understand you. My problem isn't to rotate the line, because I can rotate it perfectly, my problem is stop the rotation once it has the correct angle.
9  Game Development / Newbie & Debugging Questions / Re: Rotate player in relation to mouse position on: 2013-04-14 11:51:23
Oh sorry for don't write a bigger description of my problem.

Okay I've a little 2D game. Where the player can shot. So, I need rotate the "bow" in function of the mouse position. Really my problem isn't rotate the player, because I made it more or less. My problem is I can't stop the rotation. My problem is, when I move the mouse, the player rotate yes, but it stops never. So I want that when the player has rotated then stop. I don't know how to make that.

Here's my code

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
public void rotate(double x, double y, double cx, double cy, double n) {
      double dx = x - cx;
      double dy = y - cy;
      double r = Math.sqrt(dx*dx + dy*dy);
      double a = Math.atan2(dy, dx);
      a -= n / 180 * Math.PI;
      this.x = cx + r * Math.cos(a);
      this.y = cy + r * Math.sin(a);
   }
   
   public void render(Graphics g) {
      //image.draw((float)x, (float)y);
     g.setColor(Color.red);
      g.drawLine((float)x, (float)y, (float)x2, (float)y2);

   }
   
   public void update(GameContainer container) {
      Input input = container.getInput();
      rotation = Math.atan2( input.getMouseY() - 600/2, input.getMouseX() - 800/2 );
     
      rotate(x, y, x2, y2, rotation);
   }
10  Game Development / Newbie & Debugging Questions / Rotate player in relation to mouse position on: 2013-04-14 11:30:01
Hey guys, today my question is.... How can I rotate the player in relation to mouse position?

I tried to make it, but the player was rotated always without stop :S
11  Game Development / Newbie & Debugging Questions / Expand background & Slick2D doubts on: 2013-03-31 00:41:59
Hello, I've a problem with my background. My background is very little. So Is there some way to expand my little background when I maximize the window? Don't matter if my background will be pixelated when I expand it. I'm using Slick2D and by the by. I've a doubt with Slick2D, I don't know if I can commercialize my game made with Slick2D. So, Can I make a commercial game with Slick2D?
 Cheesy
12  Game Development / Newbie & Debugging Questions / Re: Scrolling Tile Map with Slick2D on: 2013-02-13 16:41:15
Hum... how can do it? The int and offset, (i know how to make a java int variable), so is the first time I work with a scroll of a tilemap and I don't know how to do it.  Undecided
13  Game Development / Newbie & Debugging Questions / Scrolling Tile Map with Slick2D on: 2013-02-12 22:34:36
Hey guys... i'm making a game with tile maps and i'm using Slick2D, so how can i make the screen scrolling? I'm pretty confused with this :S and basically I don't know how to do this. ^^
14  Game Development / Newbie & Debugging Questions / Re: How to call my jar and jinput with a "script" on: 2013-01-11 17:20:44
I'm using java, with jinput not lwjgl. The problem is when i play the script file, it doen't execute the jar.. And i cannot see nothing at the console. When i execute my jar with "natives" but without jinput. I can see in the console "INFO: Failed to load library: no jinput-linux in java.library.path" :S
15  Game Development / Newbie & Debugging Questions / Re: How to call my jar and jinput with a "script" on: 2013-01-10 16:41:27
T.T I've problem with that, T.T when i make the script with jinput it doesn't work :S but it works with my jar alone. Must i modify manifest file?
16  Game Development / Newbie & Debugging Questions / How to call my jar and jinput with a "script" on: 2013-01-09 15:40:17
Hi, guys Cheesy how can i call to jinput and my jar wiith a script? In my last post i ask how to release my app, and yeah they said me that, but how can i do the script for my app, a can't do it, i don't know how to do it :S Thank
17  Game Development / Newbie & Debugging Questions / Re: How to release my app? on: 2013-01-06 16:36:54
how can i merge the jar?
how can i activate jinput for win & mac too?
18  Game Development / Newbie & Debugging Questions / Re: How to release my app? on: 2013-01-06 14:13:41
but how can i "use" my jar with jinput. the error is
INFO: Failed to load library: no jinput-linux in java.library.path
19  Game Development / Newbie & Debugging Questions / Re: How to release my app? on: 2013-01-06 13:44:15
:S GUYS!! Sad, how can i call the "java jar" with the script... So it's works perfectly but  don't know how to load jinput too :S
20  Game Development / Newbie & Debugging Questions / Re: How to release my app? on: 2013-01-05 15:16:24
:S Okay Cheesy then a normal installer without updating
21  Game Development / Newbie & Debugging Questions / Re: How to release my app? on: 2013-01-05 12:48:11
You could create a launcher, which the user will download.

The problem is i don't know how to make it :/
22  Game Development / Newbie & Debugging Questions / Re: How to release my app? on: 2013-01-04 23:14:57
Thank Cheesy and the last question, could you explain to me what's this
1  
-Djava.library.path. any dependencies 

what does it do?

Sorry for too question, it's the first time i release a java app :S
23  Game Development / Newbie & Debugging Questions / Re: How to release my app? on: 2013-01-04 23:02:16
Excuse me :S, how the script? What kind of script(.sh,.bat)? How can i do for window and linux? I don't know very much about that
24  Game Development / Newbie & Debugging Questions / Re: How to release my app? on: 2013-01-04 20:32:29
My game is not big but without installer is "too" tatty  Tongue

So how can i do the "program" or shell script :S? Cheesy
25  Game Development / Newbie & Debugging Questions / How to release my app? on: 2013-01-04 19:40:03
Hey guys, i've finished my little game, now how can i make a "installer" to distribute the game? And a "shortcut" to open it like "minecraft/revenge of the titan" Grin
Thank you
26  Game Development / Newbie & Debugging Questions / Re: User Inputted Text on: 2012-12-26 18:35:51
OMC, could you help me to use that ? :s I don't know how to use it... because it doesn't work on my game
here. my code
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  
public void drawDialog(Graphics g){
      g.setColor(Color.BLACK);
      g.setFont(font);
      int i;
      for(i = 0; i < dialogs[i].length; i++){
         if(dialogs[u][i] == null) text = "";
         else text = dialogs[u][i];
         if(text.equals("<name>")){
               g.drawString(name+(System.currentTimeMillis()%500>250?"|":""), 15, 25+i*15);
               handleEvent(Event paramEvent);
         }else{
            g.drawString(text,15,25+i*15);
         }
      }
      g.drawString("Press enter to continue...",600,25+i*15);
      enter = true;
   }
public boolean handleEvent(Event paramEvent)
      {
         //determine keypress
        if(paramEvent.id==401)      
            {
            //pressed an  ASCII character
           if(paramEvent.key>=32 && paramEvent.key<=122) name+=(char)paramEvent.key;
            //delete  key
           if(paramEvent.key==8 && name.length() > 0) name = name.substring(0, name.length() - 1);
            }

         
         return true;
      }
27  Game Development / Newbie & Debugging Questions / Re: Dialog Box System on: 2012-12-24 12:05:42
okay Cheesy i understand it but now i have a tiny question. Can i put a dialog between 2 "characters" in the same file or i must create a file for every "single dialog"?
28  Game Development / Newbie & Debugging Questions / Re: Dialog Box System on: 2012-12-22 11:53:10
I thought to use an array of strings to do it but i'm not sure. And i'm using it inside my game like the classic dialogs of Zelda or Pokemon.
29  Game Development / Newbie & Debugging Questions / Dialog Box System on: 2012-12-21 18:43:26
Hi guys... this is easy :s how can i make a dialog system?... I wanna say write dialogs in a text file and insert them inside the game. Actually i have a system that load the dialogs and show them at the screen but, how can i do for "dialog jumps" i.e "First" show the first ten lines of dialogs, and after you need press enter to show more lines. :S How can i do that?
30  Game Development / Newbie & Debugging Questions / Re: User Inputted Text on: 2012-12-21 13:54:29
I think i will be able to make my own gui, only i need know what method i must use? There's a "scanner" as console input? The rest is only test
Pages: [1] 2
Play Revenge of the Titans! The situation is critical. We need fancy commanders to defend Earth, the moon, Mars!
 
Browse for soundtracks for your game!

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

The first screenshot will be displayed as a thumbnail.

The invasion has landed! On Mars! And you're there to beat 'em!
BrassApparatus (9 views)
2013-06-19 08:52:37

NegativeZero (14 views)
2013-06-19 03:31:52

NegativeZero (17 views)
2013-06-19 03:24:09

Jesse_Attard (20 views)
2013-06-18 22:03:02

HeroesGraveDev (62 views)
2013-06-15 23:35:23

Vermeer (61 views)
2013-06-14 20:08:06

davedes (61 views)
2013-06-14 16:03:55

alaslipknot (55 views)
2013-06-13 07:56:31

Roquen (77 views)
2013-06-12 04:12:32

alaslipknot (60 views)
2013-06-10 19:30:18
Smoothing Algorithm Question
by UprightPath
2013-05-28 02:58:26

Smoothing Algorithm Question
by UprightPath
2013-05-28 02:57:33

Complex number cookbook
by Roquen
2013-04-24 12:47:31

2D Dynamic Lighting
by Oskuro
2013-04-17 16:46:12

2D Dynamic Lighting
by Oskuro
2013-04-17 16:45:57

2D Dynamic Lighting
by Oskuro
2013-04-17 16:23:20

Noise (bandpassed white)
by Roquen
2013-04-05 17:36:01

Noise (bandpassed white)
by Roquen
2013-04-03 16:17:38
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!