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

#1 2012-08-03 06:20:54

Subsidel
New Scratcher
Registered: 2012-07-22
Posts: 35

Is there a way to shoot as fast as the ships velocity?

So when i move backwards- the bomb moves at the slowest speed. When i move forwards- i shoot slightly faster than ships velocity?

...I know i've been posting alot for help but i started only a couple of weeks ago and i've have been tryin to do things myself but failing  yikes

Offline

 

#2 2012-08-03 06:50:07

Prestige
Scratcher
Registered: 2008-12-15
Posts: 100+

Re: Is there a way to shoot as fast as the ships velocity?

forever
if <key [up arrow v] pressed?>
change [velocity v] by (2)
end
if <key [down arrow v] pressed?>
change [velocity v] by (-2)
end
set [velocity v] to ((velocity) * (0.86))
move (velocity) steps
set [bomb speed v] to ((([abs v] of (velocity)) * (1.1)) + (velocity))
if <key [space bar v] pressed?>
broadcast [bomb v]
end
Something like that? The bomb speed formular should work for what you want, adjust the (1.1) value if you want it to go faster or slower.  smile


"Don't insult someone until you've walked a mile in their shoes. That way, if they don't like what you have to say, you'll be a mile away and still have their shoes  smile  "

Offline

 

#3 2012-08-03 07:00:01

Subsidel
New Scratcher
Registered: 2012-07-22
Posts: 35

Re: Is there a way to shoot as fast as the ships velocity?

Ty i'll try this when i get a moment  smile  but one question- once i've fired the bomb and its moving if i press up or down- does that bomb change speed or does it remain traveling at the same speed?

Offline

 

#4 2012-08-03 07:11:12

Prestige
Scratcher
Registered: 2008-12-15
Posts: 100+

Re: Is there a way to shoot as fast as the ships velocity?

At the moment, it would change the speed. (You'll also need a way to turn the ship sprite). You should add this to the bomb sprite:

when i receive [bomb v]
point in direction ([direction v] of [ship v])
go to [ship v]
set [lock speed v] to (bomb speed)
show
repeat until <touching [edge v]?>
move (lock speed) steps
end
hide

Last edited by Prestige (2012-08-03 07:11:51)


"Don't insult someone until you've walked a mile in their shoes. That way, if they don't like what you have to say, you'll be a mile away and still have their shoes  smile  "

Offline

 

#5 2012-08-03 08:19:26

Subsidel
New Scratcher
Registered: 2012-07-22
Posts: 35

Re: Is there a way to shoot as fast as the ships velocity?

ty for ur help :-)

Offline

 

Board footer