Please give credit for this because I pulled it straight out of one of my projects.
when I receive [shot v] go to [Sprite2 v] point in direction ( [direction v] of [Sprite2 v] ) set [x v] to ((( [sin v] of (direction)) * (5)) * ( [sqrt v] of ((distance to [mouse-pointer v] ) / (75)))) set [y v] to ((( [cos v] of (direction)) * (5)) * ( [sqrt v] of ((distance to [mouse-pointer v] ) / (75)))) show set [ground? v] to [0] move (20) steps repeat until <<touching color [#00FF52]?> or <touching [edge v]?>> if <(y) < [0.00001]> switch to costume [costume2 v] end change x by (x) change y by (y) point in direction ( [atan v] of ((((x) + (x position)) - (x position)) / ((((y) + (y position)) - (y position)) + (0.000001)))) change [y v] by (-0.1) end set [ground? v] to [1]Sprite2 should be the bow.
Last edited by chanmanpartyman (2012-07-25 19:04:36)
Offline
I couldn't find a wiki article, so I guess I'll have to make one (if I remember after dinner). Quick script:
when gf clicked set [power v] to (4) forever go to x:(0) y:(0) repeat until <mouse down?> point towards [mouse-pointer v] set [x v] to ((power)*([sin v] of (direction))) set [y v] to ((power)*([cos v] of (direction))) end repeat until <touching [edge v]?> change [y v] by (gravity) change x by (x) change y by (y) if<(y) = (0)> if<(x) > (0)> point in direction (90 v) else point in direction (-90 v) end else if<(y) > (0)> point in direction ([atan v] of ((x)/(y))) else point in direction ((180)+([atan v] of ((x)/(y)))) endEdit: outposted b/c I had to stop halfway to eat dinner xD
Last edited by MoreGamesNow (2012-07-25 19:13:48)
Offline
MoreGamesNow wrote:
I couldn't find a wiki article, so I guess I'll have to make one (if I remember after dinner). Quick script:
when gf clicked set [power v] to (4) forever go to x:(0) y:(0) repeat until <mouse down?> point towards [mouse-pointer v] set [x v] to ((power)*([sin v] of (direction))) set [y v] to ((power)*([cos v] of (direction))) end repeat until <touching [edge v]?> change [y v] by (gravity) change x by (x) change y by (y) if<(y) = (0)> if<(x) > (0)> point in direction (90 v) else point in direction (-90 v) end else if<(y) > (0)> point in direction ([atan v] of ((x)/(y))) else point in direction ((180)+([atan v] of ((x)/(y)))) endEdit: outposted b/c I had to stop halfway to eat dinner xD
Why do you need that at the top?
The go to x: 0 y: 0 thing...
Offline
coolhogs wrote:
MoreGamesNow wrote:
I couldn't find a wiki article, so I guess I'll have to make one (if I remember after dinner). Quick script:
when gf clicked set [power v] to (4) forever go to x:(0) y:(0) repeat until <mouse down?> point towards [mouse-pointer v] set [x v] to ((power)*([sin v] of (direction))) set [y v] to ((power)*([cos v] of (direction))) end repeat until <touching [edge v]?> change [y v] by (gravity) change x by (x) change y by (y) if<(y) = (0)> if<(x) > (0)> point in direction (90 v) else point in direction (-90 v) end else if<(y) > (0)> point in direction ([atan v] of ((x)/(y))) else point in direction ((180)+([atan v] of ((x)/(y)))) endEdit: outposted b/c I had to stop halfway to eat dinner xDWhy do you need that at the top?
The go to x: 0 y: 0 thing...
I think that it's supposed to be where your character is.
Offline