I'm very happy to communicate you, that i've finished my tic tac toe for mac, but i have a problem....
If i want make an background image and then push the image "x"or "o" like sprites, how i can make it??
Or better, when i push on a box, it compare a "X" or "o" and than the image appear on the background.....
ok but in a window i have used "open windowedscreen(...........)but it's not working is correct or not??
Could anyone help me?
Many thanks......
How can I use sprites on a normal window ?
i'm so sorry fred ,i'm always forget the uppercase
;
; ------------------------------------------------------------
;
; PureBasic - Window-Mac os x - Tic Tac Toe
;
; (c) 2005/6 - Fasa Software - Versione 5.5
;
; ------------------------------------------------------------
;-load the decoder
InitMovie()
UseJPEGImageDecoder()
UseOGGSoundDecoder()
InitSound()
If CreateGadgetList(WindowID())
If CreateMenu(0, WindowID())
MenuItem(#PB_Menu_About,"About who made the program?"+ Chr(9) + "CMD+A")
MenuItem(#PB_Menu_Quit, "Quit" + Chr(9) + "CMD+Q")
EndIf
#ResourceFolder = "Resources/"
;#ResourceFolder = "/Users/capitan/desktop/tris/Resource/"
;-carico le risorse
CatchImage(32,?1)
CatchImage(20,?x)
CatchImage(30,?0)
CatchImage(31,?about)
P14 = LoadMovie(#PB_Any,#Resourcefolder+"campane.mp3")
P15 = LoadMovie(#PB_Any,#Resourcefolder+"boink.mp3")
P16 = LoadMovie(#PB_Any,#Resourcefolder+"pop.mp3")
P17 = LoadMovie(#PB_Any,#Resourcefolder+"risata.mp3")
P18 = LoadMovie(#PB_Any,#Resourcefolder+"appl.mp3")
P32 = LoadMovie(#PB_Any,#Resourcefolder+"about.mp3")
;-costruisco la finestra con i gadget
TextGadget(10,12,280,250,20," Select level and then Push start button!!")
OptionGadget(11, 85, 317, 60, 20, "Easy")
OptionGadget(12, 150, 317, 60, 20, "Hard")
ButtonGadget(13, 35, 350, 200, 20, "Let's start!!")
EndIf
;- seleziono il livello
Start:
livello=0
vittoria=0
SceltaFatta=0
click=0
numero=0
statocella1=0
statocella2=0
statocella3=0
statocella4=0
statocella5=0
statocella6=0
statocella7=0
statocella8=0
statocella9=0
ContaMosse=0
DisableGadget(11,0)
DisableGadget(12,0)
DisableGadget(13,0)
SetGadgetState(11,1)
ActivateGadget(13)
livello=1
Repeat
ActivateWindow()
EventID = WaitWindowEvent()
If EventID = #PB_EventMenu
Select EventMenuID()
Case #PB_Menu_Quit : Quit = 2
Case #PB_Menu_About
OpenWindow(32,230,95,335,400,#PB_Window_TitleBar,"ABOUT")
CreateGadgetList(WindowID(32))
UseWindow(32)
ButtonGadget(33, 26, 360,280, 30, "Ok, Go back to the game")
ImageGadget(31,0,0,100,83,UseImage(31))
PlayMovie(P32,0)
EndSelect
EndIf
If EventID = #PB_EventGadget
Select EventGadgetID()
Case 12
ActivateGadget(13)
livello=2
Case 13
PlayMovie(P14,0)
If livello<>0
Goto game
EndIf
Case 33
StopMovie()
CloseWindow(32)
UseWindow(0)
UseGadgetList(WindowID(0))
EndSelect
EndIf
Until Quit=2 Or EventID = #PB_Event_CloseWindow
End
If livello=1:Goto easy:EndIf
If livello=2:Goto hard:EndIf
;-livello easy + inizio
-load file binary
1:IncludeBinary "1.jpg"
faccia:IncludeBinary "faccia.bmp"
x:IncludeBinary "x.jpg"
0:IncludeBinary "0.jpg"
about:IncludeBinary "about.jpg"
this only a piece ...of code with code indent
;
; ------------------------------------------------------------
;
; PureBasic - Window-Mac os x - Tic Tac Toe
;
; (c) 2005/6 - Fasa Software - Versione 5.5
;
; ------------------------------------------------------------
;-load the decoder
InitMovie()
UseJPEGImageDecoder()
UseOGGSoundDecoder()
InitSound()
Code: Select all
InitSprite()
;OpenWindow(0,0,0,275,400,#PB_Window_SystemMenu|;#PB_Window_ScreenCentere;d,"Tris-Game") And CreateGadgetList(WindowID(0))
OpenWindowedScreen(0,0,0,275,400,1,1,1)
If CreateGadgetList(WindowID())
If CreateMenu(0, WindowID())
MenuItem(#PB_Menu_About,"About who made the program?"+ Chr(9) + "CMD+A")
MenuItem(#PB_Menu_Quit, "Quit" + Chr(9) + "CMD+Q")
EndIf
#ResourceFolder = "Resources/"
;#ResourceFolder = "/Users/capitan/desktop/tris/Resource/"
;-carico le risorse
CatchImage(32,?1)
Code: Select all
CatchSprite(19,?faccia)
CatchImage(20,?x)
CatchImage(30,?0)
CatchImage(31,?about)
P14 = LoadMovie(#PB_Any,#Resourcefolder+"campane.mp3")
P15 = LoadMovie(#PB_Any,#Resourcefolder+"boink.mp3")
P16 = LoadMovie(#PB_Any,#Resourcefolder+"pop.mp3")
P17 = LoadMovie(#PB_Any,#Resourcefolder+"risata.mp3")
P18 = LoadMovie(#PB_Any,#Resourcefolder+"appl.mp3")
P32 = LoadMovie(#PB_Any,#Resourcefolder+"about.mp3")
;-costruisco la finestra con i gadget
TextGadget(10,12,280,250,20," Select level and then Push start button!!")
OptionGadget(11, 85, 317, 60, 20, "Easy")
OptionGadget(12, 150, 317, 60, 20, "Hard")
ButtonGadget(13, 35, 350, 200, 20, "Let's start!!")
EndIf
;- seleziono il livello
Start:
livello=0
vittoria=0
SceltaFatta=0
click=0
numero=0
statocella1=0
statocella2=0
statocella3=0
statocella4=0
statocella5=0
statocella6=0
statocella7=0
statocella8=0
statocella9=0
ContaMosse=0
DisableGadget(11,0)
DisableGadget(12,0)
DisableGadget(13,0)
SetGadgetState(11,1)
ActivateGadget(13)
livello=1
Repeat
ActivateWindow()
EventID = WaitWindowEvent()
If EventID = #PB_EventMenu
Select EventMenuID()
Case #PB_Menu_Quit : Quit = 2
Case #PB_Menu_About
OpenWindow(32,230,95,335,400,#PB_Window_TitleBar,"ABOUT")
CreateGadgetList(WindowID(32))
UseWindow(32)
ButtonGadget(33, 26, 360,280, 30, "Ok, Go back to the game")
ImageGadget(31,0,0,100,83,UseImage(31))
PlayMovie(P32,0)
EndSelect
EndIf
If EventID = #PB_EventGadget
Select EventGadgetID()
Case 12
ActivateGadget(13)
livello=2
Case 13
PlayMovie(P14,0)
If livello<>0
Goto game
EndIf
Case 33
StopMovie()
CloseWindow(32)
UseWindow(0)
UseGadgetList(WindowID(0))
EndSelect
EndIf
Until Quit=2 Or EventID = #PB_Event_CloseWindow
End
Code: Select all
game:
;OpenWindowedScreen(0,0,0,275,400,0,0,0)
ImageGadget(32,0,0,100,83,UseImage(32))
DisplaySprite(19,10,10)
DisplaySprite(19,95,10)
DisplaySprite(19,180,10)
DisplaySprite(19,10,95)
DisplaySprite(19,95,95)
DisplaySprite(19,180,95)
DisplaySprite(19,10,180)
DisplaySprite(19,95,180)
DisplaySprite(19,180,180)
DisableGadget(11,1)
DisableGadget(12,1)
DisableGadget(13,1)
If livello=1:Goto easy:EndIf
If livello=2:Goto hard:EndIf
;-livello easy + inizio
-load file binary
1:IncludeBinary "1.jpg"
faccia:IncludeBinary "faccia.bmp"
x:IncludeBinary "x.jpg"
0:IncludeBinary "0.jpg"
about:IncludeBinary "about.jpg"
this only a piece ...of code with code indent
Last edited by LESTROSO on Wed Feb 08, 2006 10:06 am, edited 1 time in total.
Have you heard of
Code: Select all
code tags? they
preserve indent better
Hi LESTROSO,
Trond just recommended to use code-tags around your code in order
to make it easier to read and remain the indentation. The forum you're
speaking of is part of his signature!
Code-Tags:
[#code]
[#/code]
(without the #)
Just try it
Trond just recommended to use code-tags around your code in order
to make it easier to read and remain the indentation. The forum you're
speaking of is part of his signature!
Code-Tags:
[#code]
[#/code]
(without the #)
Just try it
Good programmers don't comment their code. It was hard to write, should be hard to read.