Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Role Play game???
- Hiyagrl
- Scratcher
24 posts
Role Play game???
So I’m making a game with a character to move around in a backdrop (but it’s a sprite) so.. y’all are probably so good at coding you are thought to be professional, so could you pls help?
The main thing I’m having trouble with is the character moving with the background (the background has to move along tho lol
Thanks for reading!
The main thing I’m having trouble with is the character moving with the background (the background has to move along tho lol
Thanks for reading!
Hello there!
I'm Hiyagrl, an eleven-year-old who loves scratch! Hope you aren't using AI ‘art’…. >:O
“United we stand, divided we fall.”
- Aesop
- MrKingofScratch
- Scratcher
100+ posts
Role Play game???
Here's some code to make a scrolling background
We can make the character change these variables in their movement script
You can add additional code if you don't want the character to be centered all of the time.
Here's a project that includes this. I made it for a different thread, but it contains everything here.
go to x: ((0) - (cameraX)) y: ((0) - (cameraY))cameraX refers to the X position you view the scene at, and cameraY refers to the Y position you view the scene at. This script offsets the position of the background (0,0) and offsets it by the camera positions (-cameraX,-cameraY) to position the background relative to the character.
We can make the character change these variables in their movement script
when moving to the right//however you're detecting movement input
change [cameraX v] by (10)//change this value based on how far the character should move
when moving to the left//however you're detecting movement input
change [cameraX v] by (-10)//change this value based on how far the character should move
when moving up//however you're detecting movement input
change [cameraY v] by (10)//change this value based on how far the character should move
when moving down//however you're detecting movement input
change [cameraY v] by (10)//change this value based on how far the character should move
You can add additional code if you don't want the character to be centered all of the time.
Here's a project that includes this. I made it for a different thread, but it contains everything here.
- Hiyagrl
- Scratcher
24 posts
Role Play game???
Ok thanks! I’ll make sure to give you credit
Hello there!
I'm Hiyagrl, an eleven-year-old who loves scratch! Hope you aren't using AI ‘art’…. >:O
“United we stand, divided we fall.”
- Aesop
- Discussion Forums
- » Help with Scripts
- » Role Play game???