Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (488)
Games in Android Showcase (112)
games submitted by our members
Games in WIP (553)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Best Approach for Bejeweled like  (Read 5740 times)
0 Members and 1 Guest are viewing this topic.
Offline ReBirth
« Posted 2011-02-13 04:17:13 »

I'm trying to create clone of Bejeweled game where you must swap two piece to get combo. When designing the game board, I stuck on how can I update the list of the pieces after a combo appeared (when the rest above it collapse and new pieces come from sky to fill). I tried to use ArrayList and two dimensional array but stucked because the combo can come in horizontal or vertical. It's hard to arrange index of the pieces. What do you think the best approach for this?
Thanks for reply.

Offline bobjob

JGO Knight


Medals: 10
Projects: 4


David Aaron Muhar


« Reply #1 - Posted 2011-02-13 05:07:46 »

Sorry never really worked on that style of game, so not sure of the best way to approach it, but I found this applet interesting. Hopefully you can track down the source
GemGame

My Projects
Games, Webcam chat, Video screencast, PDF tools.

Javagaming.org with chat room
Offline IronclawsBt

Junior Member


Medals: 1



« Reply #2 - Posted 2011-02-13 14:47:40 »

Since your board has a fixed size, you could probably just use a two dimensional array. Otherwise, you could put a an array of array lists in another class. Then program convenience methods such as get(int row, int col) and remove(row, col) which would be pretty strait forward.

It's not what you know, it's what other people think you know.
Just hope you don't get quizzed on it.
Game engine design tutorials
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline kearnel

Junior Newbie





« Reply #3 - Posted 2011-02-16 15:51:52 »

The way I would do it would be to use a two dimensional array to store the gems. I would also make my own "Gem" object. Then when the user makes three in a row I would delete the Gems that made that three-in-a-row. Next I would momentarily stop receiving user input while I play the falling gem animation.

I hope this is what your looking for. Wink
Offline kevglass

JGO Kernel


Medals: 159
Projects: 23
Exp: 18 years


Coder, Trainee Pixel Artist, Game Reviewer


« Reply #4 - Posted 2011-02-16 16:22:44 »

The demo game for Slick is a Bejeweled game called Kitipong. Source is here:

https://bob.newdawnsoftware.com/repos/slick/trunk/SlickPuzzle/

Kev

Offline ReBirth
« Reply #5 - Posted 2011-02-18 03:36:14 »

Thanks for replies everyone.
Seems two dimensional array is the best choice. The reason why I stucked on ArrayList is caused by its ability to arrange the index so no null value on middle of two value. I'm thinking to try something like
1  
2  
3  
4  
5  
6  
7  
public Gem[] arrange(Gem[] combodArray){
   ArrayList a = new ArrayList();
   for (i=0;i<combodArray.length;i++)
        if (Gem[comboRow][i] != null)
            a.add(Gem[comboRow][i])
    return a.toArray();
}

The demo game for Slick is a Bejeweled game called Kitipong. Source is here:

https://bob.newdawnsoftware.com/repos/slick/trunk/SlickPuzzle/

Kev
My browser reports invalid security issue when trying to open that page.

Offline ra4king

JGO Kernel


Medals: 345
Projects: 2
Exp: 5 years


I'm the King!


« Reply #6 - Posted 2011-02-18 04:32:36 »

https://bob.newdawnsoftware.com/repos/slick/trunk/SlickPuzzle/src/puzzle/Puzzle.java

just click continue, there is nothing wrong with the website

Offline ReBirth
« Reply #7 - Posted 2011-02-20 02:50:22 »

Firefox doesnt let me go futher so I try Chrome and get it. Hope can implement it on java2d because I dont use slick2d.

update:
I have read it and that's cool for using 3d array!  Cool however I can't see method where you
-check for combo on all showed kitty?
-make new kitties falling from the top?
the rest is fine  Grin

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

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

The first screenshot will be displayed as a thumbnail.

TehJavaDev (17 views)
2014-08-28 18:26:30

CopyableCougar4 (26 views)
2014-08-22 19:31:30

atombrot (39 views)
2014-08-19 09:29:53

Tekkerue (36 views)
2014-08-16 06:45:27

Tekkerue (33 views)
2014-08-16 06:22:17

Tekkerue (22 views)
2014-08-16 06:20:21

Tekkerue (33 views)
2014-08-16 06:12:11

Rayexar (68 views)
2014-08-11 02:49:23

BurntPizza (45 views)
2014-08-09 21:09:32

BurntPizza (36 views)
2014-08-08 02:01:56
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

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!