News:

PlayBASIC2DLL V0.99 Revision I Commercial Edition released! - Convert PlayBASIC programs to super fast Machine Code. 

Main Menu

Sliding Puzle Game!

Started by ScottieBro1, August 28, 2024, 11:26:30 AM

Previous topic - Next topic

ScottieBro1

I was wondering if someone could help me with graphics for new game.
It's a block nine, block sixteen ect... game.
I would like some numbered blocks 128x128, 64 x 64, ect...
I am more of a game programmer than a graphics designer.
Same as music and sound effects. I'm not a sound engineer but some help would be greatly appreciated.

Thanks,
Scott B.


piamoo

Quote from: ScottieBro1 on August 28, 2024, 11:26:30 AMI was wondering if someone could help me with graphics for new game.
It's a block nine, block sixteen ect... game.
I would like some numbered blocks 128x128, 64 x 64, ect...
I am more of a game programmer than a graphics designer.
Same as music and sound effects. I'm not a sound engineer but some help would be greatly appreciated.

Thanks,
Scott B.




Are you an Itch member? I suggest that you ask for help or questions here:
https://itch.io/board/10095/2d-art

Many people are good at making graphics there. For example,

https://itch.io/t/4050111/asset-achievements-icon-pack
https://itch.io/t/4002399/versatile-2d-artist-looking-for-projects

ScottieBro1

Here's a preview of the sliding block puzzle.
It works great when not clicking all over the place.
I have locked axis to stay one away but don't know why it flips out sometimes.
Can someone have a look at it and let me know what causes the glitches sometimes.
Hit spacebar to scramble. Slide with mouse. Unscramble if give up.
As long as I keep selection one away from zero then select zero all goes well.
I just don't know why sometimes a bad selection screws it up when I have code to handle one away.
Beta testers welcome. please welcome.

stevmjon

hey scott

good to see you still working on projects.

i think i have fixed the issue when randomly clicking around the screen. the problem was you locked in the first valid cell selection but didn't allow for a change until the empty cell was selected. so i just added an if statement to reset the mouse selection (see line 195 in main.pba).

also, i noticed the FPS was low when running the game so i changed the font format type to something else which sped up the FPS. it runs fast now so i needed to add SetFPS 50 so the slide animation was a consistent speed. change this for your liking though.

  i hope this helps, stevmjon.
It's easy to start a program, but harder to finish it...

I think that means i am getting old and get side tracked too easy.

kevin


  Just picking through.. does this play or not ? 


  if you want a binary style random

PlayBASIC Code: [Select]
       Y_Sign = Rnd(1)  ;  random direction (up / down)


 
   it's generally better to go 

PlayBASIC Code: [Select]
       Y_Sign = Rnd(100)>=50  ;  random direction (up / down)


 

   due to float->integer rounding found inside the RND() FAQ function.  Which is floating point internally.


  I'd probably lay the program out differently, mainly in  one loop and use states. 


    MOCK UP CODE BELLOW
 
PlayBASIC Code: [Select]
     do

gosub Draw_Scene

gosub User_Input

loop GameOverState= true

end



Draw_Scene:

Cls

// Draw the picture
for y ...
for x etc etc

drawimage Map(x,y),xpos,ypos,true

next
next

// do animation during update
if Moving_Block=true
drawimage Moving_Block_Image,Moving_Block_X,Moving_Block_Y,true
Moving_Block_X += Move_Direction_X
Moving_Block_Y += Move_Direction_Y
Moving_Frames--
if Moving_Frames=0
Moving_Block=false
endif
endif


sync
return



User_Input


if Moving_Block=false

// Get clip coordinate
if mousebutton()=1

// convert mouse to block tiles
MX_Block = MouseX()/ BlockWidth
MY_Block = Mousey()/ BlockHeight

// pick target block from current zero block
// left right/ up or down ?

// set moving blocks starting poisition and frames
Moving_Block_X =
Moving_Block_Y =

Move_Direction_X =
Move_Direction_Y =

Moving_Frames = BlockSize

Moving_Block=false
endif

endif



return