-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcrawli-tile-puzzle.rb
More file actions
74 lines (74 loc) · 2.45 KB
/
crawli-tile-puzzle.rb
File metadata and controls
74 lines (74 loc) · 2.45 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
69
70
71
72
73
74
class TilePuzzleScene
def pbMain
### MODDED/
if Kernel.pbConfirmMessage(_INTL("Do you want to skip this tile puzzle?"))
return true
end
### /MODDED
loop do
update
Graphics.update
Input.update
# Check end conditions
if pbCheckWin
@sprites["cursor"].visible=false
if @game==3
extratile=@sprites["tile#{@boardwidth*@boardheight-1}"]
extratile.bitmap.clear
extratile.bitmap.blt(0,0,@tilebitmap.bitmap,
Rect.new(@tilewidth*(@boardwidth-1),@tileheight*(@boardheight-1),
@tilewidth,@tileheight))
extratile.opacity=0
32.times do
extratile.opacity+=8
Graphics.update
Input.update
end
else
pbWait(5)
end
loop do
Graphics.update
Input.update
break if Input.trigger?(Input::C) || Input.trigger?(Input::B)
end
return true
end
# Input
@sprites["cursor"].selected=(Input.press?(Input::C) && @game>=3 && @game<=6)
dir=0
dir=2 if Input.trigger?(Input::DOWN) || Input.repeat?(Input::DOWN)
dir=4 if Input.trigger?(Input::LEFT) || Input.repeat?(Input::LEFT)
dir=6 if Input.trigger?(Input::RIGHT) || Input.repeat?(Input::RIGHT)
dir=8 if Input.trigger?(Input::UP) || Input.repeat?(Input::UP)
if dir>0
if @game==3 || (@game!=3 && @sprites["cursor"].selected)
if pbCanMoveInDir?(@sprites["cursor"].position,dir,true)
pbSEPlay("Choose")
pbSwapTiles(dir)
end
else
if pbCanMoveInDir?(@sprites["cursor"].position,dir,false)
pbSEPlay("Choose")
@sprites["cursor"].position=pbMoveCursor(@sprites["cursor"].position,dir)
end
end
elsif (@game==1 || @game==2) && Input.trigger?(Input::C)
pbGrabTile(@sprites["cursor"].position)
elsif (@game==2 && Input.trigger?(Input::Y)) ||
(@game==5 && Input.trigger?(Input::Y)) ||
(@game==7 && Input.trigger?(Input::C))
pbRotateTile(@sprites["cursor"].position)
elsif Input.trigger?(Input::B)
### MODDED/
choice = Kernel.pbMessage(_INTL("What would you like to do?"), [_INTL("Quit Puzzle"), _INTL("Skip Puzzle"), _INTL("Cancel")], 3)
if choice == 0
return false
elsif choice == 1
return true
end
### /MODDED
end
end
end
end