It looks like you're new here. If you want to get involved, click one of these buttons!
application:setBackgroundColor(0x2f3640) centerX@240 centerY@427 local function playSound(sound) Sound.new(sound):play() end --Add knives: local knivesArr={} for i=1,7 do knivesArr[i] = Bitmap.new(Texture.new("pics/knife.png",true)) knivesArr[i]:setScale(0.3) knivesArr[i]:setAnchorPoint(0.5,0.5) knivesArr[i]:setPosition(centerX, centerY+250) stage:addChild(knivesArr[i]) knivesArr[i]:setVisible(false) end currentKnifeCount=1 knivesArr[currentKnifeCount]:setVisible(true) --Add circle: local circle = Bitmap.new(Texture.new("pics/circle.png",true)) circle:setScale(0.5) circle:setAnchorPoint(0.5,0.5) circle:setPosition(240, 220) stage:addChild(circle) --Add apple to circle: local apple = Bitmap.new(Texture.new("pics/apple.png",true)) apple:setScale(0.7) apple:setAnchorPoint(0.5,0.5) apple:setY(-325) circle:addChild(apple) --Rotate circle every frame: local function onEnterFrameFunc() circle:setRotation(circle:getRotation()+1) end stage:addEventListener(Event.ENTER_FRAME, onEnterFrameFunc) --Throw knife on tap: local function throwKnife() playSound("sounds/throw.mp3") local knifeTween=GTween.new(knivesArr[currentKnifeCount], .15, {y = 410}, {delay = 0, ease = easing.linear, onComplete = function() playSound("sounds/hitWood.mp3") circle:setAlpha(1.2) local timerDelayed = Timer.delayedCall(100, function() circle:setAlpha(1) end) if currentKnifeCount |
Comments
https://deluxepixel.com
Though I definitely don't wanna make yet another clone (there're plenty of them already)
I'm thinking about using this mechanics for a mini-game inside my main game.
Like daily challenge, or daily slots.
"What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
“The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)
There is my own VERY BASIC collision detection system, which is built on top of "SpartialHash" library. All it does is...checks for collisions
It might be a bit complex to understand cuz no comments AT ALL
P.S. Use it however you want, i dont care.
Likes: Apollo14
Likes: Apollo14
setAnchorPosition() is a fantastic method that people often overlook
Likes: Apollo14
Likes: antix, MoKaLux
"What one programmer can do in one month, two programmers can do in two months." - Fred Brooks
“The more you do coding stuff, the better you get at it.” - Aristotle (322 BC)