-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathchicagoJerkoffHand.lua
executable file
·110 lines (85 loc) · 3.51 KB
/
chicagoJerkoffHand.lua
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
----------------------------------
-- THE BIG 3 VIDEO GAME ---
-- [email protected] ---
----------------------------------
-- Script sets the properties and behaviors of hands that emerge
-- for the Chicago endless runner level
local jerkoffHands = {
activeHand = nil,
groundSprite = nil
}
function jerkoffHands:update(mainScene)
if( self.activeHand ) then
if( not self.activeHand.x ) then
self.activeHand = nil
return
end
self.activeHand.spawnCounter = self.activeHand.spawnCounter - 1
if( self.activeHand.spawnCounter == 0 and self.activeHand.health > 0 and self.activeHand.x ) then
self.activeHand:play()
end
end
end
function jerkoffHands:spawn(mainScene)
if( self.activeHand) then
return nil
end
display.setDefault( "magTextureFilter", "nearest" )
display.setDefault( "minTextureFilter", "nearest" )
local jerkoffHandsheet = graphics.newImageSheet( "images/groundHandAnim.png", { width=100, height=120, numFrames=7 } )
self.activeHand = display.newSprite( jerkoffHandsheet, {{ name = "loop", start=1, count=7, time=600, loopCount=1 }} )
self.activeHand.anchorX = 0.5
self.activeHand.anchorY = 1
local x,y = mainScene.city.displayGroup:contentToLocal( mainScene.rightEdge, mainScene.foldY )
x = mainScene.city:getGroundSpawnCoordinate()
self.activeHand.spawnCounter = 90
self.activeHand.x = x + ( self.activeHand.width * 2 )
self.activeHand.y = y -26
self.activeHand.xScale = -1
mainScene.city.displayGroup:insert( self.activeHand )
self.activeHand:setSequence( "loop" )
mainScene.city:setGroundSpawnCoordinate(self.activeHand.x+70, "hand")
self.groundSprite = display.newImageRect( "images/groundHandHole.png", 64, 25 )
self.groundSprite.anchorX = 0.5
self.groundSprite.anchorY = 0.5
self.groundSprite.x = self.activeHand.x + 5
self.groundSprite.y = self.activeHand.y - 17
self.groundSprite.xScale = self.activeHand.xScale
self.groundSprite.isVisible = false
mainScene.city.displayGroup:insert( self.groundSprite )
self.activeHand.health = 2
self.activeHand.explosionScale = 0.5
self.activeHand.bDisableCollision = true
self.activeHand.xChoke = 23
self.activeHand.yChoke = 3
self.activeHand.bPerciseCollisionDetection = true
display.setDefault( "magTextureFilter", "linear" )
display.setDefault( "minTextureFilter", "linear" )
local frame = 0
local function mySpriteListener( event )
if( event.phase == "next" ) then
frame = frame + 1
if ( frame > 3 and self.activeHand ) then
self.activeHand.bDisableCollision = false
self.activeHand.explosionScale = 2
end
elseif ( event.phase == "ended" and self.groundSprite ) then
self.groundSprite.isVisible = true
self.activeHand:removeEventListener( "sprite", mySpriteListener )
end
end
self.activeHand.onPlayerCollision = function()
local voice = mainScene.sound:loadVoice( "voice-" .. mainScene:getSelectedCharacter() .. "DontTouchMe.wav" )
mainScene.sound:playVoice( voice )
local dispose = function()
audio.dispose( voice )
end
timer.performWithDelay( 5000, dispose, 1 )
end
self.activeHand:addEventListener( "sprite", mySpriteListener )
self.activeHand.bGroundSpawn = false
self.activeHand.name = "jerkoffHand"
mainScene.obstacles:addMisc(self.groundSprite,false)
return self.activeHand
end
return jerkoffHands