-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathTryGame.pb
More file actions
68 lines (57 loc) · 1.38 KB
/
TryGame.pb
File metadata and controls
68 lines (57 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#Window = 0
#Sprite = 1
InitSprite()
InitKeyboard()
UsePNGImageDecoder()
Global SpriteX, SpriteY, Speed = 15
Procedure GestionClavier()
ExamineKeyboard()
If Not KeyboardPushed(#PB_Key_Left) = 0
If Not SpriteX - Speed + 17< 0
SpriteX - Speed
EndIf
EndIf
If Not KeyboardPushed(#PB_Key_Right) = 0
If Not SpriteX + Speed + 17 > 800
SpriteX + Speed
EndIf
EndIf
If Not KeyboardPushed(#PB_Key_Up) = 0
If Not SpriteY - Speed + 17 < 0
SpriteY - Speed
EndIf
EndIf
If Not KeyboardPushed(#PB_Key_Down) = 0
If Not SpriteY + Speed + 17 > 600
SpriteY + Speed
EndIf
EndIf
EndProcedure
Procedure DisplayScreen()
ClearScreen(RGB(0, 0, 0))
DisplayTransparentSprite(#Sprite, SpriteX, SpriteY)
FlipBuffers()
EndProcedure
If OpenWindow(#Window, 10, 10, 800, 600, "VIDEO GAME")
SpriteX = WindowWidth(#Window) / 2 - 17
SpriteY = WindowHeight(#Window) / 2 - 17
OpenWindowedScreen(WindowID(#Window), 0, 0, 800, 600)
CreateSprite(0, 200, 200)
LoadSprite(#Sprite, "C:\Users\jsmr1\Pictures\Icones\objectif.png", #PB_Sprite_AlphaBlending)
Repeat
Event = WaitWindowEvent()
GestionClavier()
DisplayScreen()
Select Event
Case #PB_Event_Gadget
Select EventGadget()
EndSelect
EndSelect
Until Event = #PB_Event_CloseWindow
EndIf
; IDE Options = PureBasic 5.31 (Windows - x64)
; CursorPosition = 27
; FirstLine = 9
; Folding = -
; EnableUnicode
; EnableXP