I’ve been having difficulty setting up a game and watch like boxing game. I’ve got a idle game that I want to make as an option to make the game easier. I’ve got that down just not the ratio each interactions will have on one another.
I’ve got a drop box and a much buggier version of this sprited up if that makes it easier.
My issue right now is putting some sort of delay that starts up and prevents rapidly moving around and clicking as fast as you can. Writing this up a second time I kinda got a jist as how to do this but I’m still not sure. I want a small deal that holds you position until time has passed. There’s three areas I plan to attack from and the edge two I have dodge sequences I want to set up when I figure out gravity.y uses a bit better.
function setup()
---p1 pos
pos = 0
pos_2 = 0
pos_1 = 0
pos0 = 0
pos1 = 0
pos2 = 0
---p1 attack left touch
pos_2a = 0
pos_1a = 0
pos0a = 0
pos1a = 0
pos2a = 0
---p1 attack right touch
pos_2b = 0
pos_1b = 0
pos0b = 0
pos1b = 0
pos2b = 0
---attack check
attack = 0 ---determines if alt punch happens and controls a flame chagre overlay on the wind up
attackx = 0 ---clears attack states
aclock = 0 ---suppose to control the speed you punch
end
function draw()
---display
background(202, 131, 131, 255)
font("AmericanTypewriter-Bold")
fontSize(25)
fill(0, 0, 0, 255)
text(Gravity.x*100,WIDTH/2, HEIGHT/2 + 200)
text(pos,WIDTH/2,HEIGHT/2 + 100) --------------position check
text(pos_2,WIDTH/2 - 200,HEIGHT/2 + 50) ---------
text(pos_1,WIDTH/2 - 100,HEIGHT/2 + 50) ---
text(pos0,WIDTH/2,HEIGHT/2 + 50) --------position output
text(pos1,WIDTH/2 + 100,HEIGHT/2 +50) ---
text(pos2,WIDTH/2 + 200,HEIGHT/2 + 50) ---
text(pos_2a,WIDTH/2 - 225,HEIGHT/2 + 75) ---------
text(pos_1a,WIDTH/2 - 125,HEIGHT/2 + 75) ---
text(pos0a,WIDTH/2 - 25,HEIGHT/2 + 75) ---
text(pos1a,WIDTH/2 + 75,HEIGHT/2 +75) ---
text(pos2a,WIDTH/2 + 175,HEIGHT/2 + 75) --------shows where punches would roughly animate
text(pos_2b,WIDTH/2 - 175,HEIGHT/2 + 75) ---
text(pos_1b,WIDTH/2 - 75,HEIGHT/2 + 75) ---2 = standard punch
text(pos0b,WIDTH/2 + 25,HEIGHT/2 + 75) ---3 = "falcon" punch
text(pos1b,WIDTH/2 + 125,HEIGHT/2 +75) ---
text(pos2b,WIDTH/2 + 225,HEIGHT/2 + 75) ---------
text(attack,WIDTH/2,HEIGHT/2 + 150) ---------------attack charge
---pos check
if Gravity.x*100 < -14 then
pos = -2 elseif
Gravity.x*100 < -5 and Gravity.x*100 > -14 then
pos = -1 elseif
Gravity.x*100 > -5 and Gravity.x*100 < 5 then
pos = 0 elseif
Gravity.x*100 > 5 and Gravity.x*100 < 14 then
pos = 1 elseif
Gravity.x*100 > 14 then
pos = 2
end
---pos output
if pos == -2 then
pos_2 = 1
pos_1 = 0
pos0 = 0
pos1 = 0
pos2 = 0 else if
pos == -1 then
pos_2 = 0
pos_1 = 1
pos0 = 0
pos1 = 0
pos2 = 0 elseif
pos == 0 then
pos_2 = 0
pos_1 = 0
pos0 = 1
pos1 = 0
pos2 = 0 elseif
pos == 1 then
pos_2 = 0
pos_1 = 0
pos0 = 0
pos1 = 1
pos2 = 0 elseif
pos == 2 then
pos_2 = 0
pos_1 = 0
pos0 = 0
pos1 = 0
pos2 = 1
end
end
---attack charge
if pos_2a == 1 or
pos_1a == 1 or
pos0a == 1 or
pos1a == 1 or
pos2a == 1 or
pos_2b == 1 or
pos_1b == 1 or
pos0b == 1 or
pos1b == 1 or
pos2b == 1 then
attack = attack + 1
end
---attack clear
if attackx == 1 then
aclock = aclock + 1
end
if aclock > 20 then
aclock = 0
attackx = 0
pos_2a = 0
pos_1a = 0
pos0a = 0
pos1a = 0
pos2a = 0
pos_2b = 0
pos_1b = 0
pos0b = 0
pos1b = 0
pos2b = 0
end
function touched(touch)
---left touch
if touch.state == BEGAN and
pos_2 == 1 and
touch.x < WIDTH/2 then
pos_2a = 1
end
if touch.state == ENDED and
pos_2a == 1 and
touch.x < WIDTH/2 and
attack > 90 then
pos_2a = 3 elseif
touch.state == ENDED and
pos_2a == 1 and
touch.x < WIDTH/2 then
pos_2a = 2
end
if touch.state == BEGAN and
pos_1 == 1 and
touch.x < WIDTH/2 then
pos_1a = 1
end
if touch.state == ENDED and
pos_1a == 1 and
touch.x < WIDTH/2 and
attack > 90 then
pos_1a = 3 elseif
touch.state == ENDED and
pos_1a == 1 and
touch.x < WIDTH/2 then
pos_1a = 2
end
if touch.state == BEGAN and
pos0 == 1 and
touch.x < WIDTH/2 then
pos0a = 1
end
if touch.state == ENDED and
pos0a == 1 and
touch.x < WIDTH/2 and
attack > 90 then
pos0a = 3 elseif
touch.state == ENDED and
pos0a == 1 and
touch.x < WIDTH/2 then
pos0a = 2
end
if touch.state == BEGAN and
pos1 == 1 and
touch.x < WIDTH/2 then
pos1a = 1
end
if touch.state == ENDED and
pos1a == 1 and
touch.x < WIDTH/2 and
attack > 90 then
pos1a = 3 elseif
touch.state == ENDED and
pos1a == 1 and
touch.x < WIDTH/2 then
pos1a = 2
end
if touch.state == BEGAN and
pos2 == 1 and
touch.x < WIDTH/2 then
pos2a = 1
end
if touch.state == ENDED and
pos2a == 1 and
touch.x < WIDTH/2 and
attack > 90 then
pos2a = 3 elseif
touch.state == ENDED and
pos2a == 1 and
touch.x < WIDTH/2 then
pos2a = 2
end
---right touch
if touch.state == BEGAN and
pos_2 == 1 and
touch.x > WIDTH/2 then
pos_2b = 1
end
if touch.state == ENDED and
pos_2b == 1 and
touch.x > WIDTH/2 and
attack > 90 then
pos_2b = 3 elseif
touch.state == ENDED and
pos_2b == 1 and
touch.x > WIDTH/2 then
pos_2b = 2
end
if touch.state == BEGAN and
pos_1 == 1 and
touch.x > WIDTH/2 then
pos_1b = 1
end
if touch.state == ENDED and
pos_1b == 1 and
touch.x > WIDTH/2 and
attack > 90 then
pos_1b = 3 elseif
touch.state == ENDED and
pos_1b == 1 and
touch.x > WIDTH/2 then
pos_1b = 2
end
if touch.state == BEGAN and
pos0 == 1 and
touch.x > WIDTH/2 then
pos0b = 1
end
if touch.state == ENDED and
pos0b == 1 and
touch.x > WIDTH/2 and
attack > 90 then
pos0b = 3 elseif
touch.state == ENDED and
pos0b == 1 and
touch.x > WIDTH/2 then
pos0b = 2
end
if touch.state == BEGAN and
pos1 == 1 and
touch.x > WIDTH/2 then
pos1b = 1
end
if touch.state == ENDED and
pos1b == 1 and
touch.x > WIDTH/2 and
attack > 90 then
pos1b = 3 elseif
touch.state == ENDED and
pos1b == 1 and
touch.x > WIDTH/2 then
pos1b = 2
end
if touch.state == BEGAN and
pos2 == 1 and
touch.x > WIDTH/2 then
pos2b = 1
end
if touch.state == ENDED and
pos2b == 1 and
touch.x > WIDTH/2 and
attack > 90 then
pos2b = 3
attack = 0 elseif
touch.state == ENDED and
pos2b == 1 and
touch.x > WIDTH/2 then
pos2b = 2
end
---attack clear
if touch.state == ENDED then
attack = 0
attackx = 1
end
end
end