#7912 - SNES-lover - Sat Jun 28, 2003 12:06 pm
Hi!
I'm working on a Puyo-Puyo-like game for GBA, using HAM.
I've come to the point where I'll make the blobs vanish if four or more float together...
Anyone have ideas on how I'll make this?
I have a "map" of the playing field, showing the blobs, like this:
Code: |
CSlime* PlayMap[5*8] = {
0,0,0,0,0,
0,0,0,0,0,
0,0,0,0,0,
0,0,0,0,0,
0,0,0,0,0,
0,Slime[1],0,0,0,
Slime[2],Slime[3],Slime[5],Slime[4],0,
Slime[10],Slime[9],Slime[7],Slime[6],0,
} |
CSlime is the class used for the slimes, so this is a map of pointers to the different blobs.
Each of them also has a "color"-attribute, ranging from 1 to 4, where 1, for example, is red.
They also have an "ObjNo"-number, showing what sprite the slime in question possesses.
The active, moveable blob has the same ObjNo as the total number of blobs on-screen, as it is the last to come out, so: Slime Code: |
[SlimesOnScreen].Active = true; |
How should a function that detects if four or more blobs of the same color are connecting look?
And how do I do when one blob has dissappeared, then the ObjNos become fucked up...
I'm not too good in this, OK? Help appreciated.
Thanks in Advance
_________________
In a realm beyond sight,
the sky shines gold, not blue.
There, the Triforce might
make mortal dreams come true.
#7915 - sgeos - Sat Jun 28, 2003 4:37 pm
SNES-lover wrote: |
Hi!
I'm working on a Puyo-Puyo-like game for GBA, using HAM.
I've come to the point where I'll make the blobs vanish if four or more float together...
Anyone have ideas on how I'll make this? |
Tepples used a span based fill algorithm in his tetris game. I can't think of anything better.
-Brendan
#7918 - tepples - Sat Jun 28, 2003 5:56 pm
I made a puyo clone for PC a long time ago, as part of freepuzzlearena (http://www.pineight.com/fpa/). Take whatever you want from my puyo clone as you abide by the GNU GPL. And yes, I copy-pasted the same flood-fill code, with one change: count the number of blocks whose color was changed.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#7952 - SNES-lover - Sun Jun 29, 2003 8:35 am
Hmm...
I really don't get how your Floodfill-stuff works, tepples... :\
What does the call
ff = KAFloodFill(x, y, k | 16);
do?
I really don't get what that part of the code does, that "simple" detection-part.
Could you please make a further explanation?
_________________
In a realm beyond sight,
the sky shines gold, not blue.
There, the Triforce might
make mortal dreams come true.
#7982 - tepples - Sun Jun 29, 2003 9:05 pm
SNES-lover wrote: |
Hmm...
I really don't get how your Floodfill-stuff works, tepples |
It looks to the left for matching colors, looks to the right for matching colors, fills the line, then looks above and below for matching colors and calls itself recursively.
Quote: |
I really don't get what that part of the code does, that "simple" detection-part. |
It fills the area with color (k | 16), which I have designated to mean "color k, but this block has been seen before in this pass through the playfield". The 'ff' is the number of blocks filled.
I wrote that code four years ago, based on a QBasic game I had written a year and a half before that. When I started writing QBasic games, I had just weaned myself from Applesoft BASIC, which had line numbers and two-letter variable names. When I port my puyo clone to GBA, I'll probably use more descriptive names.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#7996 - sgeos - Mon Jun 30, 2003 6:08 am
tepples wrote: |
I wrote that code four years ago, based on a QBasic game I had written a year and a half before that. When I started writing QBasic games, I had just weaned myself from Applesoft BASIC, which had line numbers and two-letter variable names. |
How long have you been coding games?
-Brendan
#7998 - tepples - Mon Jun 30, 2003 6:33 am
I began to learn Applesoft BASIC in 4th grade (== 1991). My first real game was a video poker sim in 1994, part BASIC and part 6502 assembly language. I found the PC and QBasic in 1997 and C in 1998. When I started learning how to write homebrew software for consoles in late 1999, I chose the NES partly because of my experience with 6502 asm.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#7999 - sgeos - Mon Jun 30, 2003 8:58 am
tepples wrote: |
I began to learn Applesoft BASIC in 4th grade (== 1991)... |
That explains your in (presumably relatively) in-depth knowledge of most of the technical questions that pop up here. How were you first introduced to (programming stuff)?
-Brendan
#8021 - tepples - Mon Jun 30, 2003 8:40 pm
My very first programming experience was Logo in second grade (fall 1988). I was introduced to video games by the NES that I got for Christmas 1989.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#8047 - sgeos - Tue Jul 01, 2003 6:23 am
tepples wrote: |
My very first programming experience was Logo in second grade (fall 1988). |
Was that for school, or something you did on your own? (I'm not familiar with Logo... it almost sounds like I've heard of it...)
-Brendan
#8061 - niltsair - Tue Jul 01, 2003 3:05 pm
Logo is a programming language they use in school to teach kids, stands for Logowriter. There's an icon in the shape of a turtle, and you tell it to move x Units, rotate Left by Y, draw a line, etc.. I've done my first thing on it too, some rather limited Final Fantasy clone ;-) I haven't been programming for games 'till i discovered it could be done on the gba, last summer.
#8081 - sgeos - Tue Jul 01, 2003 5:54 pm
niltsair wrote: |
Logo is a programming language they use in school to teach kids, stands for Logowriter. There's an icon in the shape of a turtle |
I think I've used that actually, although I did everything manually... you can change the color of the lines to green and white, etc, right?
-Brendan
#8082 - niltsair - Tue Jul 01, 2003 6:01 pm
Yes. You could also draw some shape for the turtle and use it for stamps.
The 'programming' part was mostly a sequence of intructions to the turtles.
#8083 - sgeos - Tue Jul 01, 2003 7:45 pm
niltsair wrote: |
Yes. You could also draw some shape for the turtle and use it for stamps.
The 'programming' part was mostly a sequence of intructions to the turtles. |
I think I remember rotating by an arbitrary amount and then telling it to move 1000 times or so. Sometimes it would make patterns or completely fill the screen. I recall the version I used having a mirror option and a 4 turtle mirror option.
-Brendan
PS Sorry SNES-lover, this got massively off topic.