-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpong.moonshine
92 lines (78 loc) · 1.85 KB
/
pong.moonshine
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
unit Pong [
sprite Ball [
costumes [
// Not supported yet
]
sounds [
// Not supported yet
]
when 🏁 clicked [
Initialize
Reset
repeat until (Game Over = 1)[
move (speed) steps
]
]
define Reset [
goto x: (0) y: (-45)
point in direction (pick random (1) to (360))
wait (0.5) seconds
]
define Initialize [
hide variable (Winner)
set speed to (5)
show
set (Game Over) to (0)
]
when I receive (Bounce)[
turn ↻ (((Bounce Direction) - (direction)) * 2) degrees
move (speed) steps
]
when I receive (Score Player)[
change (speed) by (0.5)
Reset
]
]
sprite Paddle[
costumes [
...
]
sounds [
...
]
define struct Paddle Player[
color: Color
position: Vector2
direction: Integer
control: Block
]
define Create Paddle (player)[
set (control) to (player.control)
insert (true) at (player.index) of (Current Players)
switch costume to (player.color + " " + 3)
go to position (player.position)
point in direction (player.direction)
create clone of (myself)
]
when 🏁 clicked[
set (Players) to (5)
set (max_move) to (70)
set (lives) to (3)
set (moved) to (0)
delete all of (Current Players)
hide
Create Paddle(Paddle Player
index: (1)
color: (red)
position: Vector2 x: (0) y: (-169)
direction: Vector2 direction: (random) magnitude: (1)
control: Human Control
)
Create Paddle(Paddle Player
index: (2)
color: (orange)
position: Vector2 x: (0) y: (-169)
direction: Vector2 direction: (random) magnitude: (1)
control: Simple Move Control
)
Create Paddle(Paddle Player