Could you elaborate more?
Offline
Oh! That arrow. I thought you meant something else...Hm. I gather that this archery game is an archer(or bow or whatever) is at the bottom of the screen, and you shoot at targets at the top of the screen. Is that correct?
Offline
One last question, and I can answer your question, is this an overhead view, or is the archer actually shooting up?
Offline
Is the archer shooting across the range, or up in the air? That would make an impact.
Offline
The easiest way would be to use velocity, but you'd still have to get the arrow to point in the correct direction. This is what I would do:
when gf clicked forever go to [archer v] point towards [mouse-pointer v] if <mouse down?> set [x-vel v] to ((power)*([sin v] of (direction))) set [y-vel v] to ((power)*([cos v] of (direction))) repeat until <touching [edge v]?> change [y-vel v] by (-0.4) change x by (x-vel) change y by (y-vel) if<(y-vel) = [0]> if<(x-vel) = [0]> point in direction (180 v) else point in direction ((([abs v] of (x-vel))/(x-vel))*(90)) end else if<(y-vel) < [0]> point in direction (([atan v] of ((x-vel)/(y-vel))) + (180)) else point in direction ([atan v] of ((x-vel)/(y-vel))) end end end end
Offline
set [POWER v] to [(distance to [mouse pointer v])/(10)] set [xvel v] to [([sin v] of (POWER)) set [yvel v] to [([cos v] of (POWER)) wait until <key [space v] pressed> repeat until <<touching [target v]> or <touching [edge v]> or <y position < -200> change y by (yvel) change x by (xvel) change [yvel v] by [1] //Or however strong you want the gravity to be endThose scratchblocks are probably aq total fail, but I hope you know what I mean.
Last edited by mythbusteranimator (2012-05-18 18:16:24)
Offline
I've made a project here that will solve the problem. The scripting is a bit less complicated than moregamesnow's, but it still works, rather nicely if I do say so myself.
Offline
I've made a few arrow-shooting games that may help, but shoot from the side, not up.
Offline
MoreGamesNow wrote:
The easiest way would be to use velocity, but you'd still have to get the arrow to point in the correct direction. This is what I would do:
when gf clicked forever go to [archer v] point towards [mouse-pointer v] if <mouse down?> set [x-vel v] to ((power)*([sin v] of (direction))) set [y-vel v] to ((power)*([cos v] of (direction))) repeat until <touching [edge v]?> change [y-vel v] by (-0.4) change x by (x-vel) change y by (y-vel) if<(y-vel) = [0]> if<(x-vel) = [0]> point in direction (180 v) else point in direction ((([abs v] of (x-vel))/(x-vel))*(90)) end else if<(y-vel) < [0]> point in direction (([atan v] of ((x-vel)/(y-vel))) + (180)) else point in direction ([atan v] of ((x-vel)/(y-vel))) end end end end
You forgot something to set the power
Offline
zubblewu wrote:
MoreGamesNow wrote:
long script
You forgot something to set the power
I expected coolhogs to set the power
Offline
coolhogs wrote:
How do you do that?
by adding in the set power to [x] block at the beginning. It's already incorporated into the script.
Offline
Oh. I would do something like distance to mouse pointer / 10
Offline