Hey, so I've been working on a gun that shoots bullets. I have most things done, but now I need a way to make the bullet continue on forever. So far I have a script that shoots a bullet to the mouse using a glide block, but I need it to go until it reaches the border of the screen, even if the mouse isn't there. I hope that makes sense
Thanks in advance.
Offline
when i receive [shoot v] point towards [mouse-pointer v] repeat until <touching [edge v]?> move (5) steps end
Offline
DonutCannon wrote:
Hey, so I've been working on a gun that shoots bullets. I have most things done, but now I need a way to make the bullet continue on forever. So far I have a script that shoots a bullet to the mouse using a glide block, but I need it to go until it reaches the border of the screen, even if the mouse isn't there. I hope that makes sense
Thanks in advance.
Instead of using a glide block, use direction and move blocks...something like this should work:
when I receive [shoot v] //This is how I would do it with a bullet, but maybe you did it differently go to [player v] point towards [mouse-pointer v] show repeat until <touching [edge v]?> move (number) steps end hideEDIT: Wow, that's scary similar in timing and in script suggestion
Last edited by AtomicBawm3 (2012-07-10 12:42:23)
Offline
Ok, trying to make a form of accuracy.
Trying to use
[scratchblocks]
point towards [mouse-pointer]
point towards <<pick random (-20) to (20)> + <direction>
{scratchblocks]
Does not appear to work...
Offline
DonutCannon wrote:
Ok, trying to make a form of accuracy.
Trying to usepoint towards [mouse-pointer] point in direction ((pick random (-20) to (20)) + (direction))Does not appear to work...
fixed (your) [scripts v]
Offline
zammer990 wrote:
DonutCannon wrote:
Ok, trying to make a form of accuracy.
Trying to usepoint towards [mouse-pointer] point in direction ((pick random (-20) to (20)) + (direction))Does not appear to work...fixed (your) [scripts v]
Thanks. I saw the problem after writing, and I dunno how to edit my posts
Offline
DonutCannon wrote:
zammer990 wrote:
DonutCannon wrote:
Ok, trying to make a form of accuracy.
Trying to usepoint towards [mouse-pointer] point in direction ((pick random (-20) to (20)) + (direction))Does not appear to work...fixed (your) [scripts v]Thanks. I saw the problem after writing, and I dunno how to edit my posts
You can't until you're a scratcher, then there's just a box that says "edit" next to report
Offline
For a nice effect, try this:
go to [cannon v] point in direction ([direction v] of [cannon v]) set [inaccuracy v] to (pick random (-0.10) to (0.10)) set [speedgain v] to (pick random (0.010) to (1.000)) set [speed v] to ((1) - (speedgain)) if <(pick random (1) to (2)) = (1)> set [dir v] to [1] else set [dir v] to [2] end repeat until <touching [edge v]?> move (speed) steps change [speed v] by (speedgain) if <(dir) = [1]> turn cw (inaccuracy) degrees else turn ccw (inaccuracy) degrees end end
Last edited by SciTecCf (2012-07-10 14:11:13)
Offline
SciTecCf wrote:
For a nice effect, try this:
go to [cannon v] point in direction ([direction v] of [cannon v]) set [inaccuracy v] to (pick random (-0.10) to (0.10)) set [speedgain v] to (pick random (0.010) to (1.000)) set [speed v] to ((1) - (speedgain)) repeat until <touching [edge v]?> move (speed) steps change [speed v] by (speedgain) end
That would give the potential for an accelerating bullet, I guess it depends if you want realism or random
Offline
zammer990 wrote:
DonutCannon wrote:
Ok, trying to make a form of accuracy.
Trying to usepoint towards [mouse-pointer] point in direction ((pick random (-20) to (20)) + (direction))Does not appear to work...fixed (your) [scripts v]
K, got it to work. Thanks
Finished product here:
http://scratch.mit.edu/projects/DonutCannon/2666366
Of course, this isn't quite a game yet...
Offline