News:

Function Finder  Find all the functions within source code files

Main Menu

fruit squash

Started by micky4fun, August 07, 2010, 02:50:42 PM

Previous topic - Next topic

micky4fun

well been a while , but i have been meanibg to find some spare time to do something new ,
but due to my own programming and gfx limitations i have to find something that would be worthwhile completing , after many idea's ive come up with the match em up , as before im looking for a touchscreen game , but it could still be played by mouse control as well ,

this is in its early stage , but you can see the way its going , you have to match 2 or more fruits in a horizontal or vertical line , they will then dissapear and all above that fruit will fall down by one and a new
fruit will be added from top of screen

well theres going to be a lot more to it than that , but thats the main point
as you can see by demo you can pick any fruit at the mo it dont matter if it matches or not yet
but it will do soon


back soon with an update
slight update in next post of mine

sorry use mouse and mouse button


mick ;D

659_minifly

I Download the program and try it but i have an error :

if boxes(a).x#=boxes(thissprite).x# and boxes(a).y#<boxes(thissprite).y#

Line 126 "Error in <Main.pba,126:Fatal Error - Array Access {180} Beyond of dimensioned size {80}

regards

659_minifly

i fix it and try it look very good and works ok
i am waiting for the rest.
regards

BlinkOk

looks cool mick. good to see you back into programming

micky4fun

#4
Hi all

thanks 659_minifly
yes if you press the mouse straight away the error comes up as the mouse is over another sprite no reconised by the program ,

ive done a very slight update here to the program , my logic in the program proberly aint going to be that good when it comes to finding how many there is in a row next to each other , up or down.
but ile give it a go and see what happens

no logic in this demo yet

yep thanks blinkok , well you cant go to long without getting them fingers tapping again , also if i leave it to long i might start forgetting the commands

anyway back soon
mick ;D

sorry keep finger on mouse button to pick more than one , then let go ,
yep same fruit re-apears i know , early days

kevin


Hey Mick,

    What's the objective of the game going to be ?    Will it be like those blocks games (click blocks to kill the block and surrounding blocks )?

micky4fun

Hi Kevin

well yep to a certain degree , going to try and make it a bit more than that , but thats does play a big part of the game , once the fruit has been collected , going to try and do a bonus thing were the fruit gets
put in a bottle or something , so 4 or 5 different bottles to fill.

im just in the stage of re-writing it again to try and make in easier for me in add things to it after i get the main part working as i want it to , so i will post when its a little further down the line

mick  :)

micky4fun

#7
hi all

ok just a quick small update , working on 2 programs side by side , as working out how it will flow and seeing what it could look like , well my logic aint that great so this part is taking time , but im getting there i think

so heres the program so far , the fruit slide is you moving the fruit from one place to another to make a row of 3 at least fruits , at the moment you can move any of them , just press mousebutton and move in direction you want to swap fruit , in game it will only swap if a line can be made up ,
logic may take me a while for this , but who knows , think the program is error free so far

fruit squash1.1
is what will happen when 3 or more fruits are lined up , press mouse button over any fruits to try out
but this will be done automaticly in game
this is not error free yet but gives a taste


mick :)

micky4fun

#8
Hi all

ok heres where i am now after a few hours yesterday ,
now both bits are in the game , to test use mouse button 1 to swap fruits and mouse button 2 to pick the ones to drop , keep finger on button 2 to select more than 1 fruit at a time
at the moment you can pick any , i will do the logic stuff soon

the keen eyed amongst you will see i have used some bits of my other games for this game so far ,
well i thought ile do my re-cycling bit

mick :)

kevin


yep, those gfx tidbits do indeed look familiar :)



micky4fun

hi all ,,

as i aint posted for a few days , project is still on , but im trying to re-write as in demo's its not perfect has a few bugs and not going to go any further until that bits working 100 percent ,
also time is being taken up tryin to get our holiday to australia sorted out , not that easy to sort out either ,

back soon
mick :)

micky4fun

#11
hi all

ok first bit now done and working 100% , now the hard bit well for me anyhow ,
im trying to write a code that will check to see if once your selected piece of fruit has been moved to its new position ie swapping fruits , to now check to see if you have created  3 or more in a row , either horizontal or vertical , but this is proving more than easy ,

doe's anywon know of an easy way , so that i know what matches up in 3 or more

heres how it plays at moment , use mousebuttom to grab fruit and then move mouse the direction you want to move piece to , if that square as the same piece in your  fruit will drop

my latest code is attached
thanks
mick :)

ps.. ive added a row as well as the level to each fruit this seems to have helped me

micky4fun

hi all

ok been a busy day for me , been on this game for hours , i knew the maths part was going to be a big downfull for me , but having a stab at it anyway , so far now i have done most if not all and maybe still buggy horizontal detection part and seems a bit slow as well , so onto vertical tomorrow ,
so heres an update of game so far

mick ;D

kevin

#13
 why not use a 2D array for the grid ?  Then you can get run through it and check for runs.  

See  -> Detect Runs of Matching Tiles In 2D Array

micky4fun

#14
hi all

thanks Kevin , but alas i have spent 5 hours today trying to get this code into my game , but i cant seem to do it ,
i see it works fine as it is but i cant link the found rows to trigger my falling sprites , so i have given up for today , ile try afresh tomorrow now , i know your way is the easier but if you dont know how to do it , its proving very hard , i did try and make you code better for me to follow and put into my game , with rows 1 to 8 and levels 1 to 9 , heres the changes i made to your code so theres no -1 in the code as the map was starting at 0,0 and my game starting at row 1 level 1 , now your map starts at 1,1 as well

; PROJECT : Project3
; AUTHOR  : mic
; CREATED : 22/08/2010
; ---------------------------------------------------------------------

LoadFOnt "courier",1,32,0

Global Width =8
Global Height =9

Type tMapTile
Tile
Row_STartPos
Row_Length
EndType

Dim Map(Width,Height) as TMapTile

ResetMap()


Do

Cls

ScanForRows()

DisplayMap(100,60)

if SpaceKey()
ResetMap()
endif

Sync
loop

Function ResetMap()


For Ylp=1 to Height
For Xlp=1 to Width
Map(xlp,ylp).tile=Rnd(9)
next
next


EndFunction

Function DisplayMap(Xpos,ypos)

lockbuffer
For Ylp=1 to Height
For Xlp=1 to Width
X=Xpos+Xlp*30
Y=Ypos+Ylp*30

if Map(xlp,ylp).Row_StartPos=-1
ink $ffffff
else
ink $ff0000
endif
text x,y,Map(xlp,ylp).Tile
next
next
unlockbuffer

EndFunction


Function Reset_Rows()

For Ylp=1 to Height
For Xlp=1 to Width
Map(xlp,ylp).Row_STartpos=-1
next
next


EndFunction


Function ScanForRows()

Reset_Rows()

For Ylp=1 to Height

For Xlp=1 to Width

CurrentTile =Map(xlp,ylp).tile

if CurrentTile=Map(xlp,ylp).tile

  RunStart=Xlp
RunLength=0
For runLp=Xlp to Width
if CurrentTile=Map(runlp,ylp).tile
RunLength++
else
exitfor runlp
endif
next

; Tag a row when it's longer than 1 tile long
if RunLEngth>2
For runLp=RunStart to RunStart+RunLength-1
  text runLp*80,30,runlp+(ylp-1)*8
Map(runlp,ylp).Row_StartPos=RunStart
Map(runlp,ylp).Row_Length =RunLength
next
; Skip X loop counter forward, past this run of tile sames
Xlp=RunLP-1
endif
endif
next
next

EndFUnction

is there a way you can show rather than in red the map vectors with more than 2 in , ie map 3,3 map 3,4 map 3,5
so i can link to my game easier.

hold up ive have crudely done this now in above code , now give box numbers
thanks
mick >:(