I’m curious as to how to create game logic for something like Bejeweled, in Corona.
What’s the best way to detect objects next to each other?
I see there’s issues with collisions as if they are touching the collisions will be going off all the time and causing performance issues.
Do I create some sort of sensor on top of the images and make it 1px wider/higher than the image and see if it collides with a sensor on another image?
TIA!
[import]uid: 10389 topic_id: 18339 reply_id: 318339[/import]
Someone (I can’t recall forum name off hand) is currently working on a way to handle this sort of thing without using physics at all - which will greatly simplify this kind of thing.
I once had a go at making a simple game like this (never completed, time constraints) using sensors that, at least as far as I got into it, didn’t seem to suffer any performance issues.
… Man, I used to love Bejeweled!
Peach
[import]uid: 52491 topic_id: 18339 reply_id: 70272[/import]
Something like Jewels… would be normally realized without physics. Swapping and detection of the neighbors are simple algorithms if you think of the objects as a 2 dimensional array.
Using physics can give a twist to this type of game - I would use it only if it gives advantages in the use and feel for the player not for the detection of the neighbors.
I like this games too! [import]uid: 70114 topic_id: 18339 reply_id: 70315[/import]
yes, I would also use arrays for this.
take a look at this AS3 code
http://www.emanueleferonato.com/2011/05/09/complete-bejeweled-game-in-less-than-2kb-legible-version/
I don’t say it’s easy to understand. but that’s the cleanest approach I’ve seen so far. And with a little bit of LUA skill it should be (relatively) easy to port.
-finefin [import]uid: 70635 topic_id: 18339 reply_id: 70350[/import]
Thanks for the suggestions.
I suppose I can use transitions to move objects to new locations and arrays for comparison and logic.
[import]uid: 10389 topic_id: 18339 reply_id: 70483[/import]