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

#1 2012-08-16 09:02:49

jono3814
New Scratcher
Registered: 2012-07-18
Posts: 17

Archery game help with arrow?!?

hi, im making an archery game and need help with my arrow. ill show you the script but what happens is when i sometimes shoot it the arrow goes backwards in a circular motion. also when i hit the target the arrow resets but shoots without me actually shooting it. can some help?

when green falg clicked
set ArrowAngle to 90
set WindMovements to pick random -5 to 5
set ArrowSpeed to 3

when i receive Level2
forever
if right arrow pressed
change ArrowSpeed by 0.5
if left arrow pressed
change ArrowSpeed by -0.5
if up arrow pressed
change ArrowAngle by 1
turn 1 degree ( anticlockwise)
if down arrow pressed
change ArrowAngle by-1
turn 1 degree (clockwise)
if key space pressed
repeat until touching edge
if touching target
say hit
broadcast ResetArrow
else
move WindMovements
move ArrowSpeed
turn 1 degree ( clockwise )
if touching edge
say ahhh you missed
broadcast ResetArrow

when i receive ResetArrow
go to x -143 y -116

Offline

 

#2 2012-08-16 18:50:13

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

Re: Archery game help with arrow?!?

jono3814 wrote:

hi, im making an archery game and need help with my arrow. ill show you the script but what happens is when i sometimes shoot it the arrow goes backwards in a circular motion. also when i hit the target the arrow resets but shoots without me actually shooting it. can some help?

when gf clicked
set [ArrowAngle v] to (90)
set [WindMovements v] to (pick random (-5) to (5))
set [ArrowSpeed v] to (3)

when i receive [Level2 v]
forever
 if (key [right arrow v] pressed?)
  change [ArrowSpeed v] by (0.5)
 end
 if (key [left arrow v] pressed ?)
  change [ArrowSpeed v] by (-0.5)
 end
 if (key [up arrow v] pressed?)
  change [ArrowAngle v] by (1)
  turn ccw (1) degrees
 end
 if (key [down arrow v] pressed?)
  change [ArrowAngle v] by (-1)
  turn cw (1) degrees
 end
 if (key [space v] pressed?)
  repeat until <(touching [edge v]?) or (touching [target v]?)>
   if (touching [target v]?)
    say [hit]
    broadcast [ResetArrow v]
   else
    if <<not <(WindMovements) = (0)>> and <not <(((([abs v] of (WindMovements)) / (WindMovements)) * (90)) + (90)) = (direction)>>>
     turn cw ((WindMovements) / (10)) degrees
    end
    move (ArrowSpeed) steps
    if (touching [edge v]?)
     say [ahhh you missed]
     broadcast [ResetArrow v]
    end
   end
  end
 end

when i receive [ResetArrow v]
go to x: (-143) y: (-116)

I added/edited a few things to make the script work.

I hope that this helps!

Last edited by ErnieParke (2012-08-16 18:53:57)


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

Offline

 

#3 2012-08-16 20:46:05

bertdog
Scratcher
Registered: 2012-06-12
Posts: 100+

Re: Archery game help with arrow?!?

wow


"Losers quit when they are tired,Winners quit when they are done." smile http://blocks.scratchr.org/API.php?user=bertdog&amp;action=onlineStatus

Offline

 

#4 2012-08-16 20:50:00

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

Re: Archery game help with arrow?!?

bertdog wrote:

wow

Thanks, though I use a lot more complicated scripts in the car in Zombie Survival.


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

Offline

 

Board footer