Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Official [scratchblocks] Testing Topic 9
- Barhamaniacs4300
- Scratcher
100+ posts
Official [scratchblocks] Testing Topic 9
when green flag clicked::operators
- kodmann
- Scratcher
100+ posts
Official [scratchblocks] Testing Topic 9
turn ccw () degrees[/quote]
stop all sounds
- Matikiscool
- Scratcher
98 posts
Official [scratchblocks] Testing Topic 9
when green flag clicked
forever if <>{
move (10) steps
}end::control
Last edited by Matikiscool (Aug. 23, 2024 16:53:39)
- Matikiscool
- Scratcher
98 posts
Official [scratchblocks] Testing Topic 9
when green flag clicked
Hi Doggo!::custom-arg
define Hi Doggo!
speak [Hi! I'm Doggo!]::extension
Last edited by Matikiscool (Aug. 23, 2024 12:06:24)
- AZEEM_AZFAR
- Scratcher
65 posts
Official [scratchblocks] Testing Topic 9
when green flag clicked
forever
if <touching [platform v]?> then
set [y velocity v] to (0)
change y by (1) // Adjust position slightly to prevent sticking
end
end
- AZEEM_AZFAR
- Scratcher
65 posts
Official [scratchblocks] Testing Topic 9
when green flag clicked
set [gravity v] to (0)
forever
if <key [space v] pressed?> and <(y velocity) = (0)> then
set [y velocity v] to (10)
end
change y by (y velocity)
set [y velocity v] to ((y velocity) - (gravity))
if <touching [edge v]?> then
set [y velocity v] to (0)
end
end
- SupaYoshiBro
- Scratcher
100+ posts
Official [scratchblocks] Testing Topic 9
((length of [a ruler v] :: list)=((12) [inches v]:: sensing) :: operators
Last edited by SupaYoshiBro (Aug. 23, 2024 13:17:31)
- SupaYoshiBro
- Scratcher
100+ posts
Official [scratchblocks] Testing Topic 9
very confusing text only found in scratch forums
- UshankanDev
- Scratcher
28 posts
Official [scratchblocks] Testing Topic 9
when green flag clicked
say [I hope I'm using it right!]
if <not> then
cry
end
- SupaYoshiBro
- Scratcher
100+ posts
Official [scratchblocks] Testing Topic 9
(#3092)i fixed itwhen green flag clicked
say [I hope I'm using it right!]
if <not :: operators> then
cry :: sensing
end
- 96498cb
- Scratcher
100+ posts
Official [scratchblocks] Testing Topic 9
∧,,,∧
( ̳• · • ̳)
/ づ♡
i hope this work
yay
( ̳• · • ̳)
/ づ♡
i hope this work
yay
Last edited by 96498cb (Aug. 23, 2024 16:01:59)
- 96498cb
- Scratcher
100+ posts
Official [scratchblocks] Testing Topic 9
. {cursed
. :: ring obsolete
. :: ring variables
. :: ring #ffff00
. :: ring #00ff00
. :: ring #00ffff
. :: ring #0000ff
. :: ring #ff00ff
} :: ring
Last edited by 96498cb (Aug. 23, 2024 16:51:18)
- Matikiscool
- Scratcher
98 posts
Official [scratchblocks] Testing Topic 9
I used a prank code from the Scratch Wiki. Can you see it?when green flag clickedLast edited by kaj (Yesterday 00:00:00)
forever if <>{
move (10) steps
}end::control
- SupaYoshiBro
- Scratcher
100+ posts
Official [scratchblocks] Testing Topic 9
Hello fellow scratchers!
Last edited by griffpatch (Yesterday 06:38:17)
Last edited by griffpatch (Yesterday 06:38:17)
- 96498cb
- Scratcher
100+ posts
Official [scratchblocks] Testing Topic 9
HAHA FUNNYI used a prank code from the Scratch Wiki. Can you see it?when green flag clickedLast edited by kaj (Yesterday 00:00:00)
forever if <>{
move (10) steps
}end::control
Last edited by 96498cb (Tomorrow 69:69:69)
- 96498cb
- Scratcher
100+ posts
Official [scratchblocks] Testing Topic 9
heehee ^ω^>;( you stole king of page 156 from me.reply 2 reply
Last edited by 96498cb (Aug. 23, 2024 17:33:13)
- polygoners1
- Scratcher
100+ posts
Official [scratchblocks] Testing Topic 9
DONT DO THAT. YOU DIDNT EVEN ADD ANYTHING.\-snip-
- 96498cb
- Scratcher
100+ posts
Official [scratchblocks] Testing Topic 9
fixed kinda
Creating a platformer game in Scratch can be a fun and educational project! Here’s a basic outline to get you started on building a simple platformer:
### 1. **Setting Up the Stage**
- **Create a New Project**: Open Scratch and start a new project.
- **Design Your Level**: Draw or import your background and platform sprites. You’ll need platforms (e.g., rectangles or custom shapes) that your player can walk on.
### 2. **Creating the Player Sprite**
- **Create the Player Sprite**: Design or import a character sprite. This sprite will be controlled by the player.
- **Add Costumes**: You might want different costumes for animations (e.g., walking, jumping).
### 3. **Adding Movement Controls**
1. **Player Movement**:
- **When Green Flag Clicked**: This block starts the game.
- **Forever Loop**: Continuously check for inputs.
- **If Key Pressed**: Use these blocks to move the player left or right.
Example code to move left and right:
```when green flag clicked2. **Gravity and Jumping**:
forever
if <key [right arrow v] pressed?> then
change x by (5)
end
if <key [left arrow v] pressed?> then
change x by (-5)
end
end
```
- **Gravity**: Continuously pull the player down to simulate gravity.
- **Jump**: Detect when the jump key is pressed and apply an upward force.Example code for gravity and jumping:### 4. **Platform Collision**
```scratch
when green flag clicked
set [y velocity v] to [0]
forever
change [y velocity v] by (-1) // Gravity
change y by (y velocity)
if <key [space v] pressed?> and <(y velocity) = [0]> then
set [y velocity v] to [10] // Jump force
end
end
```
- **Platform Detection**: Check if the player is touching a platform to stop falling and enable jumping.Example code for platform collision:### 5. **Winning and Losing**
```scratch
when green flag clicked
forever
if <touching [Platform v] ?> then
set [y velocity v] to [0]
end
end
```
- **Win Condition**: You might want to create a goal sprite (e.g., a flag) that the player needs to reach.
- **Lose Condition**: You can add hazards (e.g., enemies or traps) that make the player restart the level if touched.Example code for winning:### 6. **Adding Enemies and Hazards**
```scratch
when green flag clicked
forever
if <touching [Goal v] ?> then
broadcast [You Win v]
stop [all v]
end
end
```
- **Enemy Movement**: Add enemies that move around and can cause the player to lose.
- **Hazard Detection**: Use `if <touching ?> then` blocks to detect collisions with hazards.
### 7. **Improving and Extending**
- **Add More Levels**: Create multiple backdrops and platform sprites for different levels.
- **Enhance Graphics**: Improve your sprites and backgrounds for better visuals.
- **Add Sounds**: Incorporate sounds for actions like jumping, winning, or losing.
Feel free to ask if you need more details on any part of this process or specific code examples!
Last edited by 96498cb (Aug. 23, 2024 17:37:56)