Created
April 29, 2012 02:23
-
-
Save devilstower/2523992 to your computer and use it in GitHub Desktop.
Battle Chips 0.40 part 2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Robot = class() | |
function Robot:init(x, y) | |
self.x = x | |
self.y = y | |
self.hp = 10 | |
self.direction = 0 | |
self.program = {} | |
self.step = 1 | |
self.wins = 0 | |
self.losses = 0 | |
self.bump = false | |
self.heat = 0 | |
self.flameTimer = 0 | |
self.repeatCounter = 1 | |
self.points = 0 | |
self.name = "Generobot" | |
self.treadColor = 14 | |
self.bodyColor = 14 | |
self.headColor = 15 | |
self.dishColor = 4 | |
self.damage = self.hp | |
self.radar = false | |
for i = 1, 30 do self.program[i] = nil end | |
self.bounds = Frame(0,0,0,0) | |
self.laserDelay = 0 | |
self.radarDelay = 0 | |
self.redirectValue = 0 | |
self.rf = Frame(0,0,0,0) | |
self.limits = Frame(0,0,0,0) | |
end | |
function Robot:drawLaser() | |
if self.direction == 1 then | |
self.rf = Frame(self.x + 24, self.y + 36, | |
self.x + 36, self.limits:height()) | |
elseif self.direction == 2 then | |
self.rf = Frame(self.x + 36, self.y + 24, | |
self.limits:width(), self.y + 36) | |
elseif self.direction == 3 then | |
self.rf = Frame(self.x + 24, 110, self.x + 36, self.y + 36) | |
elseif self.direction == 4 then | |
self.rf = Frame(0, self.y + 24, self.x + 36, self.y + 36) | |
end | |
noStroke() | |
fill(212, 60, 55, 92) | |
self.rf:draw() | |
sound(SOUND_SHOOT, 9773) | |
end | |
function Robot:drawRadar() | |
if self.direction == 1 then | |
self.rf = Frame(self.x + 24, self.y + 33, | |
self.x + 36, self.limits:height()) | |
elseif self.direction == 2 then | |
self.rf = Frame(self.x + 33, self.y + 24, | |
self.limits:width(), self.y + 36) | |
elseif self.direction == 3 then | |
self.rf = Frame(self.x + 24, 110, self.x + 36, self.y + 33) | |
elseif self.direction == 4 then | |
self.rf = Frame(0, self.y + 24, self.x + 33, self.y + 36) | |
end | |
noStroke() | |
fill(81, 85, 175, 50) | |
self.rf:draw() | |
sound(SOUND_POWERUP, 9772) | |
end | |
function Robot:run() | |
local p, rf, redirected | |
--displayMode(STANDARD) | |
if self.laserDelay > 0 then | |
self.laserDelay = self.laserDelay - 1 | |
self:drawLaser() | |
return true | |
end | |
if self.radarDelay > 0 then | |
self.radarDelay = self.radarDelay - 1 | |
self:drawRadar() | |
if self.radar then | |
self.step = self.redirectValue | |
sound(SOUND_HIT, 17131) | |
self.radar = false | |
self:drawRadar() | |
end | |
return true | |
end | |
-- get executable token | |
p = self.program[self.step] | |
redirected = false | |
if p == nil or p.code == nil then | |
return false | |
end | |
-- execute control | |
if p.code.short == "G" then | |
-- Goto | |
self.step = p.value | |
redirected = true | |
elseif p.code.short == "5" then | |
-- 50/50 random | |
if math.random(2) > 1 then | |
self.step = p.value | |
redirected = true | |
end | |
elseif p.code.short == "P" then | |
-- repeat | |
if self.repeatCounter < p.value then | |
self.repeatCounter = self.repeatCounter + 1 | |
self.step = self.step - 1 | |
redirected = true | |
else | |
self.repeatCounter = 1 | |
end | |
-- check sensors | |
elseif p.code.short == "D" then | |
-- damage sensor | |
if self.hp < self. damage then | |
self.damage = self.hp | |
self.step = p.value | |
redirected = true | |
end | |
elseif p.code.short == "H" then | |
-- bump sensor | |
if self.bump then | |
self.step = p.value | |
sound(SOUND_HIT, 17131) | |
redirected = true | |
end | |
self.bump = false | |
elseif p.code.short == "A" then | |
-- radar sensor | |
self:drawRadar() | |
self.radarDelay = 3 | |
self.redirectValue = p.value | |
-- take action | |
elseif p.code.short == "F" then | |
-- forward | |
if self.direction == 1 then | |
self.y = self.y + 5 | |
if self.y + 60 > self.limits:height() then | |
self.bump = true | |
self.y = self.y - 5 | |
end | |
elseif self.direction == 2 then | |
self.x = self.x + 5 | |
if self.x + 60 > self.limits:width() then | |
self.bump = true | |
self.x = self.x - 5 | |
end | |
elseif self.direction == 3 then | |
self.y = self.y - 5 | |
if self.y < 110 then | |
self.bump = true | |
self.y = self.y + 5 | |
end | |
elseif self.direction == 4 then | |
self.x = self.x - 5 | |
if self.x < 0 then | |
self.bump = true | |
self.x = self.x + 5 | |
end | |
end | |
elseif p.code.short == "L" then | |
self.direction = self.direction - 1 | |
if self.direction == 0 then self.direction = 4 end | |
elseif p.code.short == "R" then | |
self.direction = self.direction + 1 | |
if self.direction == 5 then self.direction = 1 end | |
elseif p.code.short == "B" then | |
-- forward | |
if self.direction == 3 then | |
self.y = self.y + 5 | |
if self.y + 60 > self.limits:height() then | |
self.bump = true | |
self.y = self.y - 5 | |
end | |
elseif self.direction == 4 then | |
self.x = self.x + 5 | |
if self.x + 60 > self.limits:width() then | |
self.bump = true | |
self.x = self.x - 5 | |
end | |
elseif self.direction == 1 then | |
self.y = self.y - 5 | |
if self.y < 95 then | |
self.bump = true | |
self.y = self.y + 5 | |
end | |
elseif self.direction == 2 then | |
self.x = self.x - 5 | |
if self.x < 3 then | |
self.bump = true | |
self.x = self.x + 5 | |
end | |
end | |
elseif p.code.short == "W" then | |
-- fire laser | |
self.laserDelay = 5 | |
self:drawLaser() | |
end | |
-- step forward | |
if not redirected then | |
self.step = self.step + 1 | |
end | |
end | |
function Robot:draw() | |
local i | |
-- draw | |
pushMatrix() | |
translate(self.x + 30, self.y + 30) | |
--rect(-30, -30, 30, 30) | |
if self.direction == 2 then | |
rotate(270) | |
elseif self.direction == 3 then | |
rotate(180) | |
elseif self.direction == 4 then | |
rotate(90) | |
end | |
self:drawBase() | |
popMatrix() | |
self.bounds.left = self.x | |
self.bounds.right = self.x + 60 | |
self.bounds.top = self.y + 60 | |
self.bounds.bottom = self.y | |
if self.heat > 0 then self.heat = self.heat - 0.1 end | |
end | |
function Robot:drawBase() | |
local i, c1, c2 | |
pushStyle() | |
strokeWidth(1) | |
stroke(self.heat * 22, 0, 0, 256) | |
c1 = colors[self.treadColor] | |
c2 = color(c1.r + self.heat * 22, c1.g, c1.b) | |
fill(c2) | |
if self.hp < 4 then rotate(25) end | |
if self.hp < 2 then rotate(10) translate(5, 5) end | |
rect(-30, -30, -15, 30) | |
if self.hp < 4 then rotate(-35) end | |
if self.hp == 0 then rotate(-10) translate(-5, -5) end | |
rect(15, -30, 30, 30) | |
if self.hp < 4 then rotate(10) end | |
for i = 1,5 do | |
line(-30, i * 10 - 30, -15, i * 10 - 30) | |
line(15, i * 10 -30, 30, i * 10 - 30) | |
end | |
if self.hp == 0 then rotate(5) translate(11, -11) end | |
c1 = colors[self.bodyColor] | |
c2 = color(c1.r + self.heat * 22, c1.g, c1.b) | |
fill(c2) | |
if self.hp < 2 then rotate(11) end | |
ellipse(-25, 0, 20) | |
ellipse(25, 0, 20) | |
rect(-20, -10, 20, 10) | |
rect(-15, -20, 15, -10) | |
if self.hp < 2 then rotate(-11) end | |
c1 = colors[self.headColor] | |
c2 = color(c1.r + self.heat * 22, c1.g, c1.b) | |
fill(c2) | |
if self.hp == 0 then translate(-11, -10) end | |
ellipse(0, 0, 30) | |
stroke(colors[self.dishColor]) | |
strokeWidth(5) | |
if self.hp > 0 then | |
line(-10, 10, 0, 0) | |
line(0, 0, 10, 10) | |
line(0, 0, 0, 20) | |
end | |
popStyle() | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Socket = class() | |
function Socket:init(code, x, y) | |
self.code = code | |
self.x = x | |
self.y = y | |
self.frame = Frame(x, y, x + 145, y + 32) | |
self.value = 1 | |
end | |
function Socket:draw() | |
pushStyle() | |
if self.code == nil then | |
fill(209, 205, 192, 255) | |
stroke(73, 73, 73, 255) | |
strokeWidth(2) | |
self.frame:draw() | |
for i = 0,4 do | |
rect(self.frame.left + i * 30, self.frame.bottom + 2, | |
self.frame.left + i * 30, self.frame.bottom + 6) | |
rect(self.frame.left + i * 30, self.frame.top - 6 , | |
self.frame.left + i * 30, self.frame.top - 2) | |
end | |
else | |
fill(self.code.color) | |
stroke(0, 0, 0, 255) | |
strokeWidth(1) | |
self.frame:draw() | |
font("Futura-Medium") | |
fontSize(16) | |
fill(255, 255, 255, 255) | |
text(self.code.long, | |
self.frame.left + 10, self.frame.bottom + 6) | |
if self.code.hasValue then | |
if self.code.short ~= "P" then | |
fill(63, 58, 37, 219) | |
stroke(243, 191, 5, 153) | |
strokeWidth(5) | |
ellipse(self.x + 87, self.y + 16, 20) | |
line(self.x + 90, self.y + 16, self.x + 145, | |
self.y + 16) | |
noStroke() | |
fill(231, 227, 227, 255) | |
ellipse(self.x + 110, self.y + 16, 20) | |
ellipse(self.x + 125, self.y + 16, 20) | |
rect(self.x + 110, self.y + 6, | |
self.x + 125, self.y + 26) | |
fill(47, 47, 47, 255) | |
textMode(CENTER) | |
text(self.value, self.x + 120, self.y + 15) | |
else | |
fill(231, 227, 227, 255) | |
rect(self.x + 100, self.y + 6, | |
self.x + 135, self.y + 26) | |
fill(47, 47, 47, 255) | |
textMode(CENTER) | |
text(self.value, self.x + 120, self.y + 15) | |
fill(63, 58, 37, 219) | |
stroke(243, 191, 5, 153) | |
strokeWidth(5) | |
line(self.x + 87, self.y + 30, self.x + 87, | |
self.y + 14) | |
line(self.x + 87, self.y + 16, self.x + 102, | |
self.y + 16) | |
end | |
end | |
end | |
popStyle() | |
end | |
function Socket:touched(touch) | |
if self.frame:touched(touch) then | |
return true | |
end | |
return false | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TextBox = class() | |
-- TextBox | |
-- ver. 1.0 | |
-- a control for basic string editing | |
-- ==================== | |
function TextBox:init(x, y, w, s) | |
self.x = x | |
self.y = y | |
self.w = w | |
self.text = s | |
self.blink = ElapsedTime | |
self.blinkstate = true | |
end | |
function TextBox:draw() | |
local x, w, h | |
pushStyle() | |
pushMatrix() | |
font("Futura-Medium") | |
textMode(CENTER) | |
fontSize(18) | |
rectMode(CORNER) | |
strokeWidth(1) | |
stroke(0, 0, 0, 255) | |
fill(228, 228, 228, 255) | |
translate(self.x, self.y) | |
rect(0, 0, self.w, 24) | |
stroke(255, 255, 255, 255) | |
--noFill() | |
rect(2, 2, self.w - 4, 20) | |
fill(22, 22, 22, 255) | |
text(self.text, self.w / 2, 12) | |
w, h = textSize(self.text) | |
if self.blink < ElapsedTime - 0.3 then | |
self.blink = ElapsedTime | |
self.blinkstate = not self.blinkstate | |
end | |
if self.blinkstate then | |
strokeWidth(2) | |
stroke(45, 45, 45, 255) | |
x = self.w / 2 + w / 2 + 2 | |
line(x, 3, x, 21) | |
end | |
popMatrix() | |
popStyle() | |
end | |
function TextBox:touched(touch) | |
-- move cursor? For the moment, touching a textbox has no function | |
end | |
function TextBox:acceptKey(k) | |
if k ~= nil then | |
if string.byte(k) == nil then | |
if string.len(self.text) > 0 then | |
self.text = string.sub(self.text, | |
1, string.len(self.text) - 1) | |
end | |
end | |
self.text = self.text..k | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Token = class() | |
function Token:init(code, x, y, clr) | |
-- you can accept and set parameters here | |
self.x = x | |
self.y = y | |
self.code = code | |
end | |
function Token:draw() | |
pushStyle() | |
stroke(0, 0, 0, 255) | |
strokeWidth(2) | |
fill(self.code.color) | |
rect(self.x, self.y, self.x + 130, self.y + 32) | |
fill(127, 127, 127, 255) | |
rect(self.x, self.y, self.x + 8, self.y - 8) | |
rect(self.x + 30, self.y, self.x + 38, self.y - 8) | |
rect(self.x + 60, self.y, self.x + 68, self.y - 8) | |
rect(self.x + 90, self.y, self.x + 98, self.y - 8) | |
rect(self.x + 122, self.y, self.x + 130, self.y - 8) | |
rect(self.x, self.y + 32, self.x + 8, self.y + 38) | |
rect(self.x + 30, self.y + 32, self.x + 38, self.y + 38) | |
rect(self.x + 60, self.y + 32, self.x + 68, self.y + 38) | |
rect(self.x + 90, self.y + 32, self.x + 98, self.y + 38) | |
rect(self.x + 122, self.y + 32, self.x + 130, self.y + 38) | |
noStroke() | |
fill(230, 230, 230, 255) | |
font("Futura-Medium") | |
fontSize(16) | |
text(self.code.long, self.x + 4, self.y + 6) | |
if self.code.hasValue then | |
if self.code.short ~= "P" then | |
fill(231, 227, 227, 255) | |
ellipse(self.x + 100, self.y + 16, 20) | |
ellipse(self.x + 115, self.y + 16, 20) | |
rect(self.x + 100, self.y + 6, self.x + 115, self.y + 26) | |
fill(47, 47, 47, 255) | |
text("1", self.x + 110, self.y + 4) | |
fill(63, 58, 37, 219) | |
stroke(243, 191, 5, 153) | |
strokeWidth(5) | |
ellipse(self.x + 77, self.y + 16, 20) | |
line(self.x + 80, self.y + 16, self.x + 90, self.y + 16) | |
else | |
fill(231, 227, 227, 255) | |
rect(self.x + 90, self.y + 6, | |
self.x + 125, self.y + 26) | |
fill(47, 47, 47, 255) | |
textMode(CENTER) | |
text("1", self.x + 120, self.y + 15) | |
fill(63, 58, 37, 219) | |
stroke(243, 191, 5, 153) | |
strokeWidth(5) | |
line(self.x + 77, self.y + 30, self.x + 77, | |
self.y + 14) | |
line(self.x + 77, self.y + 16, self.x + 92, | |
self.y + 16) | |
end | |
end | |
end | |
function Token:touched(touch) | |
if touch.x >= self.x and touch.x <= self.x + 130 and | |
touch.y >= self.y and touch.y <= self.y + 30 then | |
return true | |
end | |
return false | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TokenTray = class() | |
function TokenTray:init(x, y) | |
-- you can accept and set parameters here | |
self.x = x | |
self.y = y | |
self.frame = Frame(x, y, x + 200, y + 850) | |
self.selected = 0 | |
self.tokens = {} | |
self.tokens[1] = Token(codes[1], 30, 0) | |
self.tokens[2] = Token(codes[2], 30, 0) | |
self.tokens[3] = Token(codes[3], 30, 0) | |
self.tokens[4] = Token(codes[4], 30, 0) | |
self.tokens[5] = Token(codes[5], 30, 0) | |
self.tokens[6] = Token(codes[6], 30, 0) | |
self.tokens[7] = Token(codes[7], 30, 0) | |
self.tokens[8] = Token(codes[8], 30, 0) | |
self.tokens[9] = Token(codes[9], 30, 0) | |
self.tokens[10] = Token(codes[10], 30, 0) | |
self.tokens[11] = Token(codes[11], 30, 0) | |
for i = 1,11 do | |
self.tokens[i].y = self.frame:height() - i * 70 - 20 | |
end | |
end | |
function TokenTray:draw() | |
pushStyle() | |
pushMatrix() | |
fill(177, 144, 60, 142) | |
stroke(135, 122, 36, 245) | |
strokeWidth(5) | |
self.frame:draw() | |
fill(127, 127, 127, 208) | |
noStroke() | |
translate(self.x, self.y) | |
rect(4, self.frame:height() - 40, | |
self.frame:width() - 4, self.frame:height() - 4) | |
fill(252, 252, 252, 255) | |
font("Futura-Medium") | |
fontSize(16) | |
text("CHIPS", 10, self.frame:height() - 30) | |
for i = 1, table.maxn(self.tokens) do | |
self.tokens[i]:draw() | |
end | |
popMatrix() | |
popStyle() | |
end | |
function TokenTray:touched(touch) | |
t = Ttouch(touch) | |
self.selected = 0 | |
t:translate(self.x, self.y) | |
for i = 1,11 do | |
if self.tokens[i]:touched(t) then | |
self.selected = i | |
return true | |
--sound(SOUND_SHOOT, 773) | |
end | |
end | |
return false | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ttouch = class() | |
-- Translatable Touch | |
-- ver. 1.0 | |
-- maps fields of a touch but is easily modified. | |
-- ====================. | |
function Ttouch:init(touch) | |
self.x = touch.x | |
self.y = touch.y | |
self.state = touch.state | |
self.prevX = touch.prevX | |
self.prevY = touch.prevY | |
self.deltaX = touch.deltaX | |
self.deltaY = touch.deltaY | |
self.id = touch.id | |
self.tapCount = touch.tapCount | |
self.timer = 0 | |
end | |
function Ttouch:translate(x, y) | |
self.x = self.x - x | |
self.y = self.y - y | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
VColorSlider = class() | |
function VColorSlider:init(x, y) | |
self.frame = Frame(x - 30, y - 328, x + 60, y + 56) | |
self.previousY = 0 | |
self.pots = {} | |
for i = 0, 15 do | |
self.pots[i + 1] = Frame(self.frame.left, | |
self.frame.top - i * 24 - 24, | |
self.frame.right, self.frame.top - i * 24) | |
end | |
self.selected = 0 | |
end | |
function VColorSlider:draw() | |
pushStyle() | |
fill(143, 158, 166, 255) | |
stroke(25, 25, 25, 255) | |
strokeWidth(1) | |
self.frame:draw() | |
for i = 1, 16 do | |
fill(colors[i]) | |
self.pots[i]:draw() | |
end | |
popStyle() | |
end | |
function VColorSlider:touched(touch) | |
if self.frame:touched(touch) then | |
for i = 1, 16 do | |
self.selected = 0 | |
if self.pots[i]:touched(touch) then | |
strokeWidth(3) | |
stroke(106, 130, 155, 255) | |
self.selected = i | |
fill(colors[i]) | |
self.pots[i]:draw() | |
return true | |
end | |
end | |
end | |
return false | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
VRobotSlider = class() | |
function VRobotSlider:init(x, y) | |
self.frame = Frame(x - 25, y - 640, x + 35, y + 210) | |
self.previousY = 0 | |
self.pots = {} | |
for i = 1, 21 do | |
self.pots[i] = Frame(self.frame.left + 2, | |
self.frame.top - (i) * 40, | |
self.frame.right - 2, self.frame.top - (i) * 40 + 40) | |
end | |
self.selected = 0 | |
end | |
function VRobotSlider:draw(robots) | |
pushStyle() | |
textMode(CENTER) | |
font("Futura-CondensedExtraBold") | |
fontSize(32) | |
fill(208, 206, 202, 255) | |
stroke(90, 87, 87, 155) | |
strokeWidth(1) | |
self.frame:draw() | |
fontSize(32) | |
for i = 1, 21 do | |
if i == 1 then | |
fill(92, 92, 92, 183) | |
text("?", self.pots[1]:midX(), self.pots[1]:midY()) | |
end | |
if i > 1 then | |
noStroke() | |
--self.pots[i]:draw() | |
pushMatrix() | |
translate(self.pots[i]:midX(), | |
self.pots[i]:midY()) | |
scale(0.5) | |
if i > 1 then | |
robots[i - 1]:drawBase() | |
end | |
popMatrix() | |
end | |
end | |
popStyle() | |
end | |
function VRobotSlider:touched(touch) | |
if self.frame:touched(touch) then | |
for i = 1, 21 do | |
self.selected = 0 | |
if self.pots[i]:touched(touch) then | |
strokeWidth(3) | |
noFill() | |
stroke(106, 130, 155, 255) | |
self.pots[i]:draw() | |
self.selected = i - 1 | |
print(i, self.selected, self.pots[1].left) | |
return true | |
end | |
end | |
end | |
return false | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Vslider = class() | |
function Vslider:init(x, y, v) | |
self.frame = Frame(x - 30, y - 200, x + 30, y + 60) | |
self.value = v | |
self.previousY = 0 | |
end | |
function Vslider:draw() | |
pushStyle() | |
fill(143, 158, 166, 255) | |
stroke(25, 25, 25, 255) | |
strokeWidth(1) | |
self.frame:draw() | |
fill(231, 227, 227, 255) | |
noStroke() | |
ellipse(self.frame.left + 20, self.frame.top - 15, 25) | |
ellipse(self.frame.right - 20, self.frame.top - 15, 25) | |
rect(self.frame.left + 20, self.frame.top - 3, | |
self.frame.right - 20, self.frame.top - 27) | |
fill(23, 23, 23, 255) | |
textMode(CENTER) | |
fontSize(18) | |
text(self.value, self.frame.left + 30, self.frame.top - 15) | |
strokeWidth(2) | |
line(self.frame:midX(), self.frame.bottom + 10, | |
self.frame:midX(), self.frame.top - 50) | |
stroke(207, 207, 207, 255) | |
line(self.frame:midX() + 4, self.frame.bottom + 10, | |
self.frame:midX() + 4, self.frame.top - 50) | |
line(self.frame:midX() - 4, self.frame.bottom + 10, | |
self.frame:midX() - 4, self.frame.top - 50) | |
popStyle() | |
end | |
function Vslider:touched(touch) | |
if self.frame:touched(touch) then | |
self.value = math.floor((self.frame.top - 50 - touch.y) / 6) | |
if self.value < 1 then self.value = 1 end | |
if self.value > 30 then self.value = 30 end | |
return true | |
end | |
return false | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment