Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How to move the backdrop as the sprite makes an action
- CWorld
-
Scratcher
54 posts
How to move the backdrop as the sprite makes an action
Hello, I'm trying to move backdrop when the makes an action. Like if the sprite.wants to go up, down, right, left, then the backdrop should also move
So what should I do for this to make it possible
So what should I do for this to make it possible

Might be a bit difficult so make a project and share it and give me the linkI don't want to mess up !!![]()
Last edited by CWorld (May 30, 2020 16:01:01)
- Wyan100
-
Scratcher
1000+ posts
How to move the backdrop as the sprite makes an action
Hello, I'm trying to move backdrop when the makes an action. Like if the sprite.wants to go up, down, right, left, then the backdrop should also move
So what should I do for this to make it possible
Might be a bit difficult so make a project and share it and give me the link
I don't want to mess up !!
You can't move backdrops. But if you have a sprite NAMED backdrop the best way to do this is to have Code similar to this:
For Backdrop:
when green flag clicked
set [ScrollX v] to [0]
set [ScrollY v] to [0]
forever
go to x: (ScrollX) y: (ScrollY)
end
For Player:
when [Up Arrow v] key pressed
change [ScrollY v] by [-10]
when [Down Arrow v] key pressed
change [ScrollY v] by [10]
when [Left Arrow v] key pressed
change [ScrollX v] by [10]
when [Right Arrow v] key pressed
change [ScrollX v] by [-10]
Of course this is a really simple (and not very effective) way to do this, but it's the basic idea and you can tinker it to fit your game.
Last edited by Wyan100 (May 30, 2020 15:58:24)
- CWorld
-
Scratcher
54 posts
How to move the backdrop as the sprite makes an action
I m
i meant sprite named backdrop thanks to correct me!Hello, I'm trying to move backdrop when the makes an action. Like if the sprite.wants to go up, down, right, left, then the backdrop should also move
So what should I do for this to make it possible
Might be a bit difficult so make a project and share it and give me the link
I don't want to mess up !!
You can't move backdrops. But if you have a sprite NAMED backdrop the best way to do this is to have Code similar to this:
For Backdrop:when green flag clicked
set [ScrollX v] to [0]
set [ScrollY v] to [0]
forever
go to x: (ScrollX) y: (ScrollY)
end
For Player:when [Up Arrow v] key pressed
change [ScrollY v] by [-10]when [Down Arrow v] key pressed
change [ScrollY v] by [10]when [Left Arrow v] key pressed
change [ScrollX v] by [10]when [Right Arrow v] key pressed
change [ScrollX v] by [-10]
Of course this is a really simple (and not very effective) way to do this, but it's the basic idea and you can tinker it to fit your game.
- GoldBackthewebAlext
-
Scratcher
100+ posts
How to move the backdrop as the sprite makes an action
Hello, I'm trying to move backdrop when the makes an action. Like if the sprite.wants to go up, down, right, left, then the backdrop should also moveBackdrops can't move…
So what should I do for this to make it possible
But you can use a sprite as a backdrop.
First, copy the backdrop.

Go to sprite and paste the backdrop.

Enlarge it (the more the better)

Now put this code in the sprite (before a backdrop).
when green flag clicked
go to [back v] layer :: looks
show
when I receive [move up v]
repeat (... :: grey)
change x by (... :: grey) // must be a positive number
end
when I receive [move down v]
repeat (... :: grey)
change x by (... :: grey) // must be a negative number
end
when I receive [move forward v]
repeat (... :: grey)
change y by (... :: grey) // must be a positive number
end
when I receive [move backwards v]
repeat (... :: grey)
change y by (... :: grey) // must be a negative number
end
- CWorld
-
Scratcher
54 posts
How to move the backdrop as the sprite makes an action
C
Last edited by CWorld (May 31, 2020 06:36:51)
- Discussion Forums
- » Help with Scripts
-
» How to move the backdrop as the sprite makes an action


