Discuss Scratch

MrPy
New to Scratch
5 posts

Need help getting broadcast to work in car game.

Greetings all!

I am new to Scratch and am trying to get a simple broadcast message to work to shoot a “laser” sprite from my car position when the spacebar is pressed.
Here is the project: https://scratch.mit.edu/projects/173276139/
Thanks for any help.
gor-dee
Scratcher
500+ posts

Need help getting broadcast to work in car game.

You were nearly there
when I receive [fireSpace v]
go to x: ([x position v] of [car (1) v]) y: ([y position v] of [car (1) v])
point in direction ([direction v] of [car (1) v])
show
repeat until <touching [edge v] ?>
move (10) steps
end
hide

you need to turn your car costume 90 degrees too. It's just a weird Scratch thing that in the editor a costume facing right will face up in the project if pointing to 0
MrPy
New to Scratch
5 posts

Need help getting broadcast to work in car game.

Thanks,

Got it working
EPICPIKAGUY
Scratcher
100+ posts

Need help getting broadcast to work in car game.

gor-dee wrote:

You were nearly there
when I receive [fireSpace v]
go to x: ([x position v] of [car (1) v]) y: ([y position v] of [car (1) v])
point in direction ([direction v] of [car (1) v])
show
repeat until <touching [edge v] ?>
move (10) steps
end
hide

you need to turn your car costume 90 degrees too. It's just a weird Scratch thing that in the editor a costume facing right will face up in the project if pointing to 0

Yeah, normally zero corresponds to “not rotated at all”, but the team behind scratch decided to make 90º the default angle.

Also, you might want to add a stamp block to the lazer.
gor-dee
Scratcher
500+ posts

Need help getting broadcast to work in car game.

You might like to try this:

instead of the broadcast use create clone of lazer
instead of when I receive broadcast use when i start as a clone
instead of hide use delete this clone
MrPy
New to Scratch
5 posts

Need help getting broadcast to work in car game.

Thanks for the advice Scratcher. I have worked on it a bit, it's coming along.

Octon Invasion project

To Do:
-Levels
-Explosions (scribbled placeholders now)
-Multiple aliens and obstacles
-Music
-Alt weapons
-More sound effects
-New laser artwork
-Start Page

—MrPy

Powered by DjangoBB

Standard | Mobile