Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / Some unpredictable results with a 2d mahjong

Author
Message
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 8th Jan 2017 15:35 Edited at: 12th Apr 2018 20:57
1>The value tilesLeft only gets decremented when it removes the tile but for some reason the amount of tiles left don't equal tilesLeft towards the end

2>I call two functions youWin() and youLose() but it doesn't seem to show the graphics in the routine it does however recreate the tiles

full code so far no media is needed as its created within
fubar
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 8th Jan 2017 16:46
i add a message here and it pop up. i think only 2 visible tiles can hide.
Quote: "
function removeTiles(num as integer,num2 as integer)
SetSpriteVisible(tiles[num].id,0)
SetSpriteVisible(tiles[num2].id,0)
if tiles[num].visible=0 then Message("huuh")
if tiles[num2].visible=0 then Message("huuh")

tiles[num].visible=0:tiles[num2].visible=0
//tiles[num].selected=0:tiles[num2].selected=0
dec tilesLeft,2
endfunction
"
AGK (Steam) V2.0.22 : Windows 10 Pro 64 Bit : AMD (16.12.1) Radeon R7 265 : Mac mini OS Sierra (10.12)
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 8th Jan 2017 20:26 Edited at: 12th Apr 2018 20:58
I relocated the code that called the youWin() and youLose() functions to just after the main do loop



That fixed the calling of them routines now the only problem is why my tilesLeft variable isn't correct to the actual amount of tiles left that I can see
fubar
damothegreat
User Banned
Posted: 8th Jan 2017 20:33
Good luck with Mahjong, a nice addictive game to many
Using Tier 1 AppGameKit V2
Started coding with AMOS
Works with a Lenovo IdeaPad 700, 1TB SSD (Data), 128GB HD (System), 12GB Ram, GeForce Nvdia 950M, Windows 10, 2.3Ghz (Turbo to 3.2ghz when required)
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 8th Jan 2017 23:22
for any reason this "removeTiles" is called but this two tiles did not have both the visible flag.
you should reduce the duplicated code and using some more functions.


AGK (Steam) V2.0.22 : Windows 10 Pro 64 Bit : AMD (16.12.1) Radeon R7 265 : Mac mini OS Sierra (10.12)
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 9th Jan 2017 04:35 Edited at: 12th Apr 2018 20:58
Thanks Marcus

I found the problem was in the logic the previousId and previousImg had to be set to zero after calling the removeTiles Function


I now load an image of sprites only 9 so far but it fixed a bug I had when I changed the virtual resolution or the phone tried too
I also now set the virtual resolution 800 by 600
fubar
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 9th Jan 2017 07:40
for the game state i also using a Type / Struct.
AGK (Steam) V2.0.22 : Windows 10 Pro 64 Bit : AMD (16.12.1) Radeon R7 265 : Mac mini OS Sierra (10.12)
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 10th Jan 2017 03:50
Good idea Markus

So far I have it working which may be seen here http://users.tpg.com.au/subarpk/Mahjong/Mahjong.html

fubar
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 10th Jan 2017 03:52 Edited at: 12th Apr 2018 20:58
the code used is below but I didn't include the media as it uses the Media that came with the asset packs

fubar
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 10th Jan 2017 04:00
1>I still need to modify the shuffle routine or make a different shuffle routine that allows the player to shuffle if there isn't a feasible move
2>and add a feasible move test
3>and improve the general look lol
fubar
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 10th Jan 2017 12:42 Edited at: 12th Apr 2018 20:59
I didn't need complex bubble sorts or anything like that to sort the tiles
but I did change the shuffle function to this

That works quite fast with my old Samsung Galaxy J1 and allows the tiles to be shuffled once in a game
fubar
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 10th Jan 2017 15:46
Quote: "shuffle routine"

i made 2004 a mahjong in blitz basic 3d, i can give you the source
AGK (Steam) V2017.01.09 : Windows 10 Pro 64 Bit : AMD (16.12.1) Radeon R7 265 : Mac mini OS Sierra (10.12.2)
fubarpk
Retired Moderator
19
Years of Service
User Offline
Joined: 11th Jan 2005
Playing: AGK is my friend
Posted: 10th Jan 2017 20:39
Thanks Marcus but not needed
At first I thought I needed to sort by columns and rows in the shuffle
but there was no need to, as all I needed to do was swap the images
but only the ones that are presently visible just a bug I had problem solved
fubar
Markus
Valued Member
20
Years of Service
User Offline
Joined: 10th Apr 2004
Location: Germany
Posted: 10th Jan 2017 21:48
i believe there was a trick to sort the pieces that the game should solvable.
if the shuffle is wrong it can be unsolvable.
btw, i do not understand my old source code but i had at the time when i developed it. he he

AGK (Steam) V2017.01.09 : Windows 10 Pro 64 Bit : AMD (16.12.1) Radeon R7 265 : Mac mini OS Sierra (10.12.2)

Login to post a reply

Server time is: 2024-04-27 05:23:38
Your offset time is: 2024-04-27 05:23:38