1) I've set up quasi gravity so the character falls to the ground, but not through it. I want the character to walk left and right to wherever the mouse was clicked and be able to travel up and down hills/slopes. I've isolated the horizontal movement but I can't figure out how to make it detect and follow the slope of the hill. Right now it just moves into/through the hill.
2a) I want the character to jump with some acceleration so this is what I tried:
Code: Select all
on mouseUp
put true into sPlayerJump
playerJump
end mouseUp
on playerJump
if sPlayerJump is true then
repeat with x = 6 to 1
if x >= 1 then
set the top of button "player" to the top of button "player" - x
else
put false into sPlayerJump
end if
end repeat
else
repeat with x = 1 to 6
set the top of button "player" to the top of button "player" + x
end repeat
end if
end playerJump
I'm not getting any errors, but the "player" button isn't moving.
2b) How would I implement this with a swipe gesture where the character jumps in the direction/angle of the swipe? I've read the tutorials but I can't seem to get any gestures working.
3) I want to tap somewhere and have a graphic rotate to face that position. I've got it set up to find that angle and I have an answer dialog popping up to show that it is in fact returning an angle, but when I "set the angle" of the graphic it doesn't move. Again I'm not getting any errors, but the graphic doesn't do anything. I'm also getting some wonky angles like I click somewhere and it shows 75 degrees for example, then I move the mouse a few millimeters and click again and it says 1003 degrees...
Code: Select all
on mouseDown
put the loc of graphic "rectangle" into tButtonLoc
put the mouseloc into tMouseLoc
put ((item 1 of tMouseLoc) - (item 1 of tButtonLoc)) into tAngleX
put ((item 2 of tMouseLoc) - (item 2 of tButtonLoc)) into tAngleY
put the ((tan of (tAngleY/tAngleX))*180/pi) into sFireAngle
end mouseDown
on mouseUp
answer the round of sFireAngle
end mouseUp
All of these samples are in separate files by the way. I'm trying to wrap my head around all of these actions before putting them together into one file.