Java-Gaming.org Hi !
Featured games (81)
games approved by the League of Dukes
Games in Showcase (513)
Games in Android Showcase (119)
games submitted by our members
Games in WIP (576)
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]
1  Java Game APIs & Engines / Engines, Libraries and Tools / Re: turn-based animation on: 2012-07-31 13:54:52
Yes, this is actually the same principle I came to after few days of trying different approaches and hitting various dead ends Smiley Hope it will be solid as more and more features will be added in...
Thanks
2  Game Development / Newbie & Debugging Questions / Re: Slick2d turn based on: 2012-07-27 13:35:07
Thanks, this one looks like really solid design. Now, I have some testing implementation of flag-based turns and it seems to be working fine....we will see how it works with more features added. If it does not work well, I will definitely move to your state based design...
3  Java Game APIs & Engines / Engines, Libraries and Tools / Re: turn-based animation on: 2012-07-26 16:04:04
Sorry, can you elaborate it a little bit (maybe with small code sample) as I do not get it. Maybe I am mising the basic point of update()/render()/draw() methods. I tried to add something like this to slicks update() method just for testing if the image will be at least somehow moved slowly but it did not work:
1  
2  
3  
4  
for (int i=10000; i>=0; i--) {
   hero.x += i*0.000001f;
   hero.hero1.draw(hero.x, hero.y); //does not draw anything actually
}

Loop updates hero.x slowly but does not draw anything during any of these 10000 steps. Image is just drawn in the render method after the whole loop finishes (so it is "jumping" and not "sliding to the next position").
Thanks
4  Game Development / Newbie & Debugging Questions / Re: Tiled getTileProperty method (Slick2D) on: 2012-07-26 11:31:38
Yes, this would be a way to go. Create 2d array of booleans and set values during map loading....then ask this array if the tile is blocked instead of tile property. Or you can add second layer to your tilemap.
5  Java Game APIs & Engines / Engines, Libraries and Tools / turn-based animation on: 2012-07-25 22:04:14
Hi,
I am working on small turn-based game and now thinking about some easy way to animate objects. What I want to achive is to let for example player character to animate from one tile to other (so if I press RIGHT key, it will not only jump eg. 32 pixels to the right but slowly slide there with animation). Something like in dungeons of dremor but not so fancy of course:
http://www.youtube.com/watch?v=gIKH36J1wQQ

I know how to run animation but don't know how to fit it in the turn-based model. I do something like this in my hero class:
1  
2  
3  
4  
5  
public void act() {
   if (control.action == Actions.RIGHT) {
      hero1.setCurrentFrame(frame);  //hero1 is instance of Animation
       x=x+32;
      frame ^= 1;   // switch between two frames


Then render() and update() methods do just following:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
public void render(GameContainer container, StateBasedGame game, Graphics g)
      throws SlickException {
     hero.hero1.draw(hero.x, hero.y);
     
         }

@Override
public void update(GameContainer container, StateBasedGame game, int delta)
      throws SlickException {
   hero.act();


I would normaly put this slide/animation code to update/render methods but it does not seem to be a good idea with my turn-based design (need to keep track if player's instance already played and/or can play again, etc.).
Is there some way to render animation outside the GameState's render() method? I tried to call hero1.draw(x,y) method in a loop in my hero's class but it did not draw anything at all.
Thank you...hope my question is clear.
6  Game Development / Newbie & Debugging Questions / Re: Slick2d turn based on: 2012-07-23 19:17:48
Different States?

1  
2  
3  
public final int START_SCREEN;
public final int GAME_ROOM;
public final int BATTLE;

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
update() {

   keyboardCheck();
   mouseCheck();

   switch (state) {
      case START_SCREEN: break;
      case GAME_ROOM: break;
      case BATTLE:
         if (turn == 1) { /* do stuff */ }
   }
}


Would that work?

I am already using StateBasedGame superclass in my project but it is good for menus, etc. (I can imagine using it for switching levels if count is limited) but probably not for game logic.
I would also like to separate key controls from game update (to avoid loong if/else/switch statements in the main update method) so I will probably put it to different class implementing one of the InputListeners (maybe to hero class or to seperate one and use composition...need to think about it). We will see what turns out to be the best way Smiley
Thanks for suggestions.
7  Game Development / Newbie & Debugging Questions / Re: Slick2d turn based on: 2012-07-23 18:12:56
Thanks for reply. Yes, I know that slick2d takes care of update. However it does not seem to be suitable for turn based game (I press some key, slicks move my character, then some NPC tooks his turn, other NPC till my turn starts again)....I mean I cannot put my game logic to update() method because it runs too fast. In other words update would process many turns on "single" key press and thats not what you want in turn based games. However I kind of solved it by putting game logic to overriden keyPressed(int, char) method....hope it will work.
And there comes another question....I need custom keyrepeat intervals. How can this be achieved since "public void enableKeyRepeat(int initial,
int interval) is deprecated and does not seem to work? Sad
Thanks again.
8  Game Development / Newbie & Debugging Questions / Slick2d turn based on: 2012-07-23 17:33:21
Hi all,
I would like to develop small turn based game with slick2d but I cannot imagine a way how to do it in slick2d update() method. It is quite easy to develop own game loop for turn based game but how to do it in slick2d with its update/render methods? Any idea how to tell update() method to wait until something happens (keypress or player action taken)?
I have tried something like:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
   public void update(GameContainer container, StateBasedGame game, int delta)
         throws SlickException {
      boolean played = false;
     
      while (played == false) {
         Input input = container.getInput();
         if (input.isKeyDown(Input.KEY_RIGHT)) {
            container.resume();
            x = x + 32;
            played = true;
         }
      }

   }

But window got unresponsive and input never received my keypress.

I am quite new to slick2d so maybe it is just some misunderstanding of the basic library concepts on my end (very probably). Thank you.
Pages: [1]
 

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

The first screenshot will be displayed as a thumbnail.

Longarmx (46 views)
2014-10-17 03:59:02

Norakomi (37 views)
2014-10-16 15:22:06

Norakomi (29 views)
2014-10-16 15:20:20

lcass (32 views)
2014-10-15 16:18:58

TehJavaDev (62 views)
2014-10-14 00:39:48

TehJavaDev (62 views)
2014-10-14 00:35:47

TehJavaDev (52 views)
2014-10-14 00:32:37

BurntPizza (70 views)
2014-10-11 23:24:42

BurntPizza (40 views)
2014-10-11 23:10:45

BurntPizza (82 views)
2014-10-11 22:30:10
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

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
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!