Ok... this might be alittle complicated...
Im flying my ship in space... when i shoot i would like my bomb to bounce -only once- against any wall (there are many small walls in the same colour). If it bounces from a wall into a diff wall- i would prefer it to explode (or just dissapear if its easier)
Anyone have any scratch block suggestions?
Thankyou
Offline
My script up to now for the sprite 2 (bomb) is:
When [s] key is pressed
go to sprite 1 (ship)
point in direction [direction] of [sprite1]
{Repear until touching [edge]? or touching colour []?
{ Show
{__Move 3 steps
hide
go to [sprite1]
this script shoots the bomb- soon as it hits the wall- my bomb dissapears... reset
Offline
when [s v] key pressed set [touched v] to (0) repeat until <(touched) = (2)> move (speed) steps if <touching color [#000000]?> change [touched v] by (1) point in direction ((direction) * (-1)) end end explosion script
Offline
Subsidel wrote:
hmm for some reason it didnt seem to work- wouldnt let me highlight it thanx for helping tho!
As far as I know, the only highlighting in Scratch happens to be in text boxes, and you don't seem like you're talking about text boxes.
This may be your problem. :V
Offline
He doesn't want that. And no offense, it is not too realistic.
Offline
Sorry to reply late- when i entered the script u gave me zammer, for some reason it wouldnt work- yeh i was talkin about the script box not highlighting when i click it: thought normally it does that when it works (i am new however). Also mayb it doesnt work for me because i havent got an idea of how variables work: though i can add them in just like in your script.
I'm gonna look at daniels script of ball bouncing because my maths coding for the bounce means whatever direction its in before it bounces- it will - or + the direction number so... if i fire 130 degrees at an straight wall like this diagram: ___/___ it will bounce back at -130 derees meaning the bomb wants to go thro wall \
but really it should go o / o
_______________________ ____\/___ etc
Sorry if i don't make any sense lol
Offline
Just to clarify now that ive noticed my first diagram got changed after i submitted it, when i fire at 130 degrees at a straight wall it bounces back -130 degrees like this diagram______________________________/______________________________________________ \
o
Offline
Subsidel wrote:
Lol been tryin to figure out this all day... its gotta be some wierd mathmatical code. If anyone can figure it out- ur a genius lol.
I'm not sure what you're trying to do. Make the ball bounce? Or make it bounce only once then explode when it hits a wall
Offline
Trying to make it exactly like this http://www.scratch.mit.edu/ext/youtube/?v=UKvnLuNtlUc where the bomb bounces before exploding... but everytime i try and make the bomb bounce- some angles is fine but others doesnt work out.
Offline