Discuss Scratch

Llama_turd
Scratcher
5 posts

mouse rotation for FPS 3d shooter

if i have a first person game i need to learn how to rotate with the mouse does anyone know how? i will post the game and u can comment on how. thx a lot and I will put u in credits
AwesomeSmilee
Scratcher
500+ posts

mouse rotation for FPS 3d shooter

when gf clicked
set [_oldMouseX v] to (mouse x)
set [_oldMouseY v] to (mouse y)
forever
if <(mouse x) > (_oldMouseX)> then
turn right script :: custom
end
if <(mouse x) < (_oldMouseX)> then
turn left script :: custom
end
if <(mouse y) > (_oldMouseY)> then
look up script :: custom
end
if <(mouse y) < (_oldMouseY)> then
look down script :: custom
end
set [_oldMouseX v] to (mouse x)
set [_oldMouseY v] to (mouse y)
Llama_turd
Scratcher
5 posts

mouse rotation for FPS 3d shooter

thx u so much but how do I get look up block look down block left and right block @AwesomeSmilee or the purple blocks and what sprite do I put the programming on ( aim gun backdrop door)

Last edited by Llama_turd (March 6, 2016 17:25:36)

Llama_turd
Scratcher
5 posts

mouse rotation for FPS 3d shooter

how do iget purple blocks and which sprite do I put coding in ( aim gun backdrop door ) pls look at game -call of duty firefight- and how do I define the purple blocks

Last edited by Llama_turd (March 6, 2016 18:04:25)

peti345
Scratcher
33 posts

mouse rotation for FPS 3d shooter

Llama_turd you replace the purple blocks with the script whats needed there

Check out Mob Arena!
when green flag clicked
load s# :: custom
TheLogFather
Scratcher
1000+ posts

mouse rotation for FPS 3d shooter

If you want a more ‘fluid’ movement, including continuous left-right rotation when the cursor is nearer the edges, then you may find this helpful:


- - 360º panorama panning with mouse - -

The script you want is on the Stage (custom block “Check User Movement”). What that does is to change the variables “MyAng” (horizontal rotation angle) and “MyUpAng” (angle to look up and down) as the user moves the mouse around.

In the case of that project, those vars are then used to stamp the background in the appropriate place. But in your case you would use the “MyAng” var as the direction (i.e. angle) that the player is looking around the horizontal surface on which they are walking, and the “MyUpAng” would be used to ‘shift’ the first-person view up and down by some appropriate amount.

Hope that makes sense!

(If you really want to add something extra fun and different, I have a head-controlled version, via web-cam, here. )

Last edited by TheLogFather (June 10, 2016 21:34:37)


Siggy the Kumquat slayer:
Main account: DadOfMrLog –– Frameworks for basic pen-rendered 3D in scratch (see studio). Examples:

- - - - 3D Text - - - - - - Simple shapes - - - Controllable structures - - - On the ground - - - - - - In space - - - -

Internent_Games
Scratcher
1 post

mouse rotation for FPS 3d shooter

when green flag clicked
forever

end
aspectsvg
Scratcher
12 posts

mouse rotation for FPS 3d shooter

this is a keyboard movement
when [ w key pressed
change y by (5)
when [ s] key pressed
change y by (-5)
when [ a] key pressed
change x by (-5)
when [ d] key pressed
change x by (5)
aspectsvg
Scratcher
12 posts

mouse rotation for FPS 3d shooter

if that did not work then
when [ a] key pressed
change x by (5)
when [ d] key pressed
change x by (-5)

Powered by DjangoBB