Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (778)
Games in Android Showcase (231)
games submitted by our members
Games in WIP (856)
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 10385 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: 12
Projects: 4

David A M

« 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
Offline IronclawsBt

Junior Devvie

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 Spiffy Duke »

Medals: 319
Projects: 25
Exp: 22 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:


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
public Gem[] arrange(Gem[] combodArray){
   ArrayList a = new ArrayList();
   for (i=0;i<combodArray.length;i++)
        if (Gem[comboRow][i] != null)
    return a.toArray();

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

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

Offline ra4king

JGO Kernel

Medals: 508
Projects: 3
Exp: 5 years

I'm the King!

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

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.

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  

hadezbladez (360 views)
2018-11-16 13:46:03

hadezbladez (194 views)
2018-11-16 13:41:33

hadezbladez (363 views)
2018-11-16 13:35:35

hadezbladez (91 views)
2018-11-16 13:32:03

EgonOlsen (2193 views)
2018-06-10 19:43:48

EgonOlsen (2228 views)
2018-06-10 19:43:44

EgonOlsen (1385 views)
2018-06-10 19:43:20

DesertCoockie (2023 views)
2018-05-13 18:23:11

nelsongames (1677 views)
2018-04-24 18:15:36

nelsongames (2313 views)
2018-04-24 18:14:32
Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08

Deployment and Packaging
by gouessej
2018-08-22 08:03:45

Deployment and Packaging
by philfrei
2018-08-20 02:33:38

Deployment and Packaging
by philfrei
2018-08-20 02:29:55

Deployment and Packaging
by philfrei
2018-08-19 23:56:20

Deployment and Packaging
by philfrei
2018-08-19 23:54:46 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‑
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!