Created a nice software using SpiderBasic ? Post you link here !
pf shadoko
 
Posts: 74
Joined: Thu May 26, 2016 11:09 am

Zen Puzzle

by pf shadoko Fri Dec 08, 2017 1:42 pm

my first SB game
this is a classic puzzle game.
it doesn't work yet on touch screens (but it shouldn't be very complicated to manage)
if you have suggestions or if you see bugs, do not hesitate to report it to me.

http://cg.racine.free.fr/puzzle/
Comtois
 
Posts: 40
Joined: Mon Feb 24, 2014 11:07 pm

Re: Zen Puzzle

by Comtois Fri Dec 08, 2017 2:38 pm

waouh !

C'est du 100% SpiderBasic ou y'a des gros morceaux de JavaScript là dedans ?

En tout cas, chapeau, tes démos et jeux sont toujours propres, ça donne envie. Je vais commencer par 20 pièces pour me détendre :)

1000 pièces ça doit rendre nerveux, pas zen


wow!

Is it 100% SpiderBasic ?

Anyway, your demos and games are always clean. I'll start with 20 pieces to relax:)

1000 pieces must make you nervous, not Zen.
pf shadoko
 
Posts: 74
Joined: Thu May 26, 2016 11:09 am

Re: Zen Puzzle

by pf shadoko Fri Dec 08, 2017 3:09 pm

Yes, it's SB.
just the minimum of javascript for what is not yet taken into account: full screen/local storage/...
but it only represents a few lines
on the other hand, I had to redo the lib "VectorDrawing" which is not really usable for games (slowness problem)
I posted my version on
viewtopic.php?f=9&t=1272
Dirk Geppert
 
Posts: 58
Joined: Fri Sep 22, 2017 7:02 am

Re: Zen Puzzle

by Dirk Geppert Mon Dec 11, 2017 8:49 am

@pf shadoko: Very impressive - well done!
User avatar
SparrowhawkMMU
 
Posts: 262
Joined: Wed Aug 19, 2015 3:02 pm
Location: United Kingdom

Re: Zen Puzzle

by SparrowhawkMMU Tue Dec 12, 2017 10:41 am

Just played a game. Excellent! :)

One suggestion: as it is supposed to be a Zen game, an option to disable/hide the timer would be good.
pf shadoko
 
Posts: 74
Joined: Thu May 26, 2016 11:09 am

Re: Zen Puzzle

by pf shadoko Tue Dec 12, 2017 11:27 am

it's just
Dirk Geppert
 
Posts: 58
Joined: Fri Sep 22, 2017 7:02 am

Re: Zen Puzzle

by Dirk Geppert Wed Dec 13, 2017 7:40 am

@pf shadoko: can you give me a tip please, on how to create the puzzle pieces?
pf shadoko
 
Posts: 74
Joined: Thu May 26, 2016 11:09 am

Re: Zen Puzzle

by pf shadoko Wed Dec 13, 2017 1:57 pm

@ Dirk Geppert :

i use this code :
Code: Select all
Macro cola(col,a=$ff):(col|(a<<24)):EndMacro

Procedure piece(type,l.f,sh.f,sd.f,sb.f,sg.f)
    Protected dx,dy
   
    Macro forme(l,sh,sd,sb,sg,dec)
        dx=2*l+dec
        dy=2*l+dec
        MovePathCursor(dx-l,dy-l)
        AddPathCurve(dx,dy+(-1-sh)*l, dx,dy+ (-1+sh)*l,dx+ l,dy-l)
        AddPathCurve(dx+(1+sd)*l,dy,dx+ (1-sd)*l, dy, dx+l,dy+ l)
        AddPathCurve( dx,dy+ (1+sb)*l, dx,dy+ (1-sb)*l,dx -l,dy+l)
        AddPathCurve( dx+(-1-sg)*l, dy,dx+ (-1+sg)*l, dy, dy-l,dy -l)
        ClosePath()
    EndMacro
       
    la=1
    VectorSourceColor(cola($888888)):FillVectorOutput()   
    forme(l,sh,sd,sb,sg,0):ClipPath():DrawVectorImage(ImageID(0))
    forme(l,sh,sd,sb,sg, la):VectorSourceColor(cola($ffffff,$44)):StrokePath(la*2)   
    forme(l,sh,sd,sb,sg,-la):VectorSourceColor(cola($000000,$44)):StrokePath(la*2)
   
EndProcedure

ex=800
ey=600
OpenWindow(0, 0, 0, ex,ey, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
CanvasGadget(0, 0, 0, ex,ey)

CreateImage(0,200,200,32,$ff888888)
StartVectorDrawing(ImageVectorOutput(0))
For i=0 To 100:AddPathCircle(Random(200),Random(200),Random(50)):VectorSourceColor(Random($ffffffff)):FillPath():Next
StopVectorDrawing()

StartVectorDrawing(CanvasVectorOutput(0))
piece(0,64,0.5,0.5,0.5,0.5)
StopVectorDrawing()

CompilerIf #PB_Compiler_OS <> #PB_OS_Web
    Repeat:Event = WaitWindowEvent():Until Event = #PB_Event_CloseWindow
CompilerEndIf


work with PB but don't work with SB
(no ClipPath() function in VectorDrawing lib )

use instead my version :
viewtopic.php?f=9&t=1272
(remove exemple part)
Dirk Geppert
 
Posts: 58
Joined: Fri Sep 22, 2017 7:02 am

Re: Zen Puzzle

by Dirk Geppert Fri Dec 15, 2017 7:54 am

Hi pf shadoko, thank you for your support! But how do you create the puzzle pieces, every single one of them?
How to remove the unwanted parts of the pixels for each piece of the puzzle?
You know what I mean? :-)
pf shadoko
 
Posts: 74
Joined: Thu May 26, 2016 11:09 am

Re: Zen Puzzle

by pf shadoko Fri Dec 15, 2017 12:01 pm

i add some comments :
Code: Select all
XIncludeFile("...") ;<--- my vectordrawing lib

Macro cola(col,a=$ff):(col|(a<<24)):EndMacro

Procedure piece(type,li.f,lp.f,sh.f,sd.f,sb.f,sg.f,x,y)
    Protected dx,dy
   
    Macro forme(l,sh,sd,sb,sg,dec)
        dx=lp+dec
        dy=lp+dec
        MovePathCursor(dx-li,dy-li)
        AddPathCurve(dx,dy+(-1-sh)*li, dx,dy+ (-1+sh)*li,dx+ li,dy-li)
        AddPathCurve(dx+(1+sd)*li,dy,dx+ (1-sd)*li, dy, dx+li,dy+ li)
        AddPathCurve( dx,dy+ (1+sb)*li, dx,dy+ (1-sb)*li,dx -li,dy+li)
        AddPathCurve( dx+(-1-sg)*li, dy,dx+ (-1+sg)*li, dy, dy-li,dy -li)
        ClosePath()
    EndMacro
       
    la=1
    VectorSourceColor(cola($888888)):FillVectorOutput()   
    forme(li,sh,sd,sb,sg,0):ClipPath():MovePathCursor(-x,-y):DrawVectorImage(ImageID(0))
    forme(li,sh,sd,sb,sg, la):VectorSourceColor(cola($ffffff,$44)):StrokePath(la*2)   
    forme(li,sh,sd,sb,sg,-la):VectorSourceColor(cola($000000,$44)):StrokePath(la*2)
   
EndProcedure

ex=800
ey=600
OpenWindow(0, 0, 0, ex,ey, "", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
ImageGadget(0, 0, 0, ex,ey,0)

; image source
CreateImage(0,256,256,32,$ff888888)
StartVectorDrawing(ImageVectorOutput(0))
For i=0 To 100:AddPathCircle(Random(256),Random(256),Random(20)+20):VectorSourceColor(Random($ffffffff)):FillPath():Next
StopVectorDrawing()

limage=128          ; image width
lpiece=limage*1.2   ; piece width (+20 %)
posx=100            ; position x inside image
posy=100            ; position y inside image

Ipiece=CreateImage(-1,lpiece,lpiece,32,#PB_Image_Transparent)
StartVectorDrawing(ImageVectorOutput(ipiece))
piece(0,limage/2,lpiece/2,0.5,0.5,0.5,0.5,posx,posy)
StopVectorDrawing()
SetGadgetState(0,ImageID(ipiece))

CompilerIf #PB_Compiler_OS <> #PB_OS_Web
    Repeat:Event = WaitWindowEvent():Until Event = #PB_Event_CloseWindow
CompilerEndIf
Return to Showcase

Who is online

Users browsing this forum: No registered users and 1 guest