Hey. Made a simple, 2-person MtG life counter. Using the ui.lua, and ZoomEven config.
Inspiration:
Button Counter Forum Post
Button Events Template
Feel free to comment/update. Would like to include dice roll and poison counter tally at some point.
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 | local ui = require("ui") --HALF BACKGROUND-- local Rect = display.newRect(0, 0, 340, 240) Rect:setFillColor( 64, 64, 64, 255 ) --CALLING COUNTER and SCORE and BUTTON-- local counter = 20 local counter2 = 20 local score local score2 --CREATING BUTTON FUNCTIONALITY-- local button1press = function ( event ) counter = counter - 1 score.text = ''..counter end local button2press = function ( event ) counter = counter + 1 score.text = ''..counter end local button3press = function ( event ) counter2 = counter2 + 1 score2.text = ''..counter2 end local button4press = function ( event ) counter2 = counter2 - 1 score2.text = ''..counter2 end local button1 = ui.newButton{ default = "arrow.png", over = "arrow2.png", onPress = button1press, emboss = true } local button2 = ui.newButton{ default = "arrow.png", over = "arrow2.png", onPress = button2press, emboss = true } local button3 = ui.newButton{ default = "arrow.png", over = "arrow2.png", onRelease = button3press, emboss = true } local button4 = ui.newButton{ default = "arrow.png", over = "arrow2.png", onRelease = button4press, emboss = true } --DISPLAY BUTTONS-- button1.x = 60; button1.y = 70 button1.rotation = 270 button1.xScale = .7; button1.yScale =.7 button2.x = 60; button2.y = 150 button2.rotation = 90 button2.xScale = .7; button2.yScale =.7 button3.x = 60; button3.y = 330 button3.rotation = 270 button3.xScale = .7; button3.yScale =.7 button4.x = 60; button4.y = 410 button4.rotation = 90 button4.xScale = .7; button4.yScale =.7 --DISPLAY SCORE-- score = display.newText( 0, 0, 0, native.systemFontBold, 120 ) score:setTextColor( 255, 255, 255 ) score.x = 200; score.y = 110 score.rotation = 180 score2 = display.newText( 0, 0, 0, native.systemFontBold, 120 ) score2:setTextColor( 255, 255, 255 ) score2.x = 200; score2.y = 370 |