Hi guys!
For an assignment at school, my team and I have to create a new concept for a game.
To impress the judges, we’ve decided to make a little prototype of our idea.
We want to make it happen on an iPad, so Codea seemed the easiest solution (because we don’t have a mac).
To make things short, I’ve started modifing an example project (Gravity).
But their are stil some stuff (not much) that I want to change (but I don’t know how).
Let me provide the current code now
function draw()
GravityX = Gravity.x
GravityY = Gravity.y
background(127, 127, 127, 255)
stroke (255, 255, 255, 255)
strokeWidth(7)
lineCapMode(Round)
pushMatrix()
translate(WIDTH / 2, HEIGHT / 2)
grav = vec2(Gravity.x * 300, Gravity.y * 300)
rect (-50,0,100,20)
line(0,0,grav.x, grav.y)
down = vec2(1, 0)
orient = down::angleBetween(grav)
pushMatrix()
resetMatrix()
translate(WIDTH / 2, HEIGHT / 2)
translate(grav.x, grav.y)
rotate(math.deg(orient))
ellipse (0,0,40,40)
popMatrix()
end
The issue is that the lenght of the line is also variable to the position the iPad is held in.
-
It would be nice if that lenght was fixed
-
Now the line stops moving when the iPad is held still
Is their a solution to make a swinging movement (that the line moves a bit after the iPad is held stillà
Thanks in advance!