Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Shooter game
- BryleM2324
-
Scratcher
6 posts
Shooter game
So basically, i want that when the player is pressing the screen they can also move with the joystick. Heres the project if u wanna help https://scratch.mit.edu/projects/959423234/ thanks in advance!
- BryleM2324
-
Scratcher
6 posts
Shooter game
Maybe you should use arrow keys in stead of a joystick.Good idea! Maybe i will. Thanks for the idea!
- mastergamerx-details
-
Scratcher
100+ posts
Shooter game
Maybe you should use arrow keys in stead of a joystick.in addition, you could have the arrow keys on the screen big enough so it's easy to touch, and have a button in the middle to replace the touching the screen you're talking about. (i dont have a mobile device so i might not help)
- mastergamerx-details
-
Scratcher
100+ posts
Shooter game
you could set the sprite to draggable so you could drag it around around without needing a joystick.
go to sensing and you will see “set drag mode to _”
go to sensing and you will see “set drag mode to _”
- 27xz
-
Scratcher
65 posts
Shooter game
You would want code that looks something like this in the joystick's sprite:
The only problem which this could create is the problem of infinite shooting. To fix this, I would recommend making an extra button which allows the player to shoot where they next click instead of move. You could use a variable to detect whether the player is in shooting or moving mode, and use if/then statements with said variable to decide whether the joystick should appear or the player should shoot when the screen is pressed.
when green flag clicked
forever
go to x: (mouse x) y: (mouse y)
end
when green flag clicked
forever
if <mouse down?> then
show
else
hide
end
end
The only problem which this could create is the problem of infinite shooting. To fix this, I would recommend making an extra button which allows the player to shoot where they next click instead of move. You could use a variable to detect whether the player is in shooting or moving mode, and use if/then statements with said variable to decide whether the joystick should appear or the player should shoot when the screen is pressed.
- PieringLunarYT
-
Scratcher
23 posts
Shooter game
when green flag clicked
repeat (10)
forever
if <rightkey pressed> then
change x by (10)
end
end
end
- PieringLunarYT
-
Scratcher
23 posts
Shooter game
when green flag clicked
set [ gravity] to [0]
forever
change y by (gravity)
change [ gravity] by (-1)
if <touching [ ground] ?> then
set [ gravity] to [0]
if <key [ up arrow] pressed?> then
set [ gravity] to [15]
end
end
end
- PieringLunarYT
-
Scratcher
23 posts
Shooter game
is u do not want keys make arror sprites and put
when this sprite clicked
ask [put my other the right key post and for left change all number is negative ] and wait
- BryleM2324
-
Scratcher
6 posts
Shooter game
You would want code that looks something like this in the joystick's sprite:when green flag clicked
forever
go to x: (mouse x) y: (mouse y)
endwhen green flag clicked
forever
if <mouse down?> then
show
else
hide
end
end
The only problem which this could create is the problem of infinite shooting. To fix this, I would recommend making an extra button which allows the player to shoot where they next click instead of move. You could use a variable to detect whether the player is in shooting or moving mode, and use if/then statements with said variable to decide whether the joystick should appear or the player should shoot when the screen is preYou would want code that looks something like this in the joystick's sprite:check the code plswhen green flag clicked
forever
go to x: (mouse x) y: (mouse y)
endwhen green flag clicked
forever
if <mouse down?> then
show
else
hide
end
end
The only problem which this could create is the problem of infinite shooting. To fix this, I would recommend making an extra button which allows the player to shoot where they next click instead of move. You could use a variable to detect whether the player is in shooting or moving mode, and use if/then statements with said variable to decide whether the joystick should appear or the player should shoot when the screen is pressed.
Last edited by BryleM2324 (Feb. 24, 2024 00:32:10)
- irnm
-
Scratcher
11 posts
Shooter game
So basically, i want that when the player is pressing the screen they can also move with the joystick. Heres the project if u wanna help https://scratch.mit.edu/projects/959423234/ thanks in advance!Possiby make the fire rate faster?
- BryleM2324
-
Scratcher
6 posts
Shooter game
Heres the link of the studio if u wanna help me make ghe mobile version https://scratch.mit.edu/studios/34692991 thx
Last edited by BryleM2324 (Feb. 24, 2024 17:46:32)
- Discussion Forums
- » Help with Scripts
-
» Shooter game