This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2012-07-25 17:28:24

coolhogs
Scratcher
Registered: 2011-07-26
Posts: 1000+

I know I posted this before but...

I can't find it...
I need some bow and arrow gravity...  wink


Get ready for domination of:  tongue

Offline

 

#2 2012-07-25 19:03:09

chanmanpartyman
Scratcher
Registered: 2011-05-30
Posts: 500+

Re: I know I posted this before but...

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

 

#3 2012-07-25 19:13:07

MoreGamesNow
Scratcher
Registered: 2009-10-12
Posts: 1000+

Re: I know I posted this before but...

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))))
end
Edit: outposted b/c I had to stop halfway to eat dinner xD

Last edited by MoreGamesNow (2012-07-25 19:13:48)


http://images2.layoutsparks.com/1/218929/rubiks-cube-animated-rotating.gif
"Cogito ergo sum" --  I think, therefore I am

Offline

 

#4 2012-07-25 21:41:13

coolhogs
Scratcher
Registered: 2011-07-26
Posts: 1000+

Re: I know I posted this before but...

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))))
end
Edit: 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...


Get ready for domination of:  tongue

Offline

 

#5 2012-07-25 21:53:13

ErnieParke
Scratcher
Registered: 2010-12-03
Posts: 1000+

Re: I know I posted this before but...

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))))
end
Edit: 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...

I think that it's supposed to be where your character is.


http://i46.tinypic.com/35ismmc.png

Offline

 

Board footer