Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Problem
- 7lvangenne
- New to Scratch
4 posts
Problem
I am working on a game that is kind of like slender man but with different concepts. I have come to the point where I am stuck with my code and I have a scroll Y and Scroll X and I want a sprite to follow me around slowly like on slender man but it wont work because of the scroll. To see the problem click https://scratch.mit.edu/projects/229473274/
- ScratchDiogoh
- Scratcher
1000+ posts
Problem
You can do:
when green flag clicked
forever
set y to ((scroll Y) + (ypos))
set x to ((scroll X) + (xpos))
end
+1700 Bad Posts
- deck26
- Scratcher
1000+ posts
Problem
I don't know anything about slender man but I'm guessing the sprite should be moving in ‘real world’ coordinates. All movement is calculated in those terms and scrollx/y are then used to calculate the screen position. The screen in a scroller is just a window onto part of the ‘real world’.
Backdrops have fixed real world coordinates (they never move in real world terms) but where they appear on screen depends on our window on the real world. Things that move in the real world are slightly different but at any point in time they have a real world position which is treated the same as for fixed objects - you just apply scrollx/y as an adjustment.
That's all the multiples of 480 are doing in an x-scroller - they give different backdrop sprites/clones different real world positions to which you apply scrollx/y as an adjustment.
I have a project which shows this https://scratch.mit.edu/projects/92682141/
Backdrops have fixed real world coordinates (they never move in real world terms) but where they appear on screen depends on our window on the real world. Things that move in the real world are slightly different but at any point in time they have a real world position which is treated the same as for fixed objects - you just apply scrollx/y as an adjustment.
That's all the multiples of 480 are doing in an x-scroller - they give different backdrop sprites/clones different real world positions to which you apply scrollx/y as an adjustment.
I have a project which shows this https://scratch.mit.edu/projects/92682141/
- 7lvangenne
- New to Scratch
4 posts
Problem
Thank you for the quick responses I will try them out as soon as possible
- 7lvangenne
- New to Scratch
4 posts
Problem
Deck26,
I have checked the tutorial, it only shows how the scrolling works but now how to do the slender man.
ScratchDiogoh
I checked your solution but it brings the sprite off screen some where off the actual map.
I have checked the tutorial, it only shows how the scrolling works but now how to do the slender man.
ScratchDiogoh
I checked your solution but it brings the sprite off screen some where off the actual map.
- ScratchDiogoh
- Scratcher
1000+ posts
Problem
Deck26,Have you placed in the Player?
I have checked the tutorial, it only shows how the scrolling works but now how to do the slender man.
ScratchDiogoh
I checked your solution but it brings the sprite off screen some where off the actual map.
+1700 Bad Posts
- ScratchDiogoh
- Scratcher
1000+ posts
Problem
ScratchDiogohI asked you a question
Check it out on this link https://scratch.mit.edu/projects/92682141/
+1700 Bad Posts
- deck26
- Scratcher
1000+ posts
Problem
Deck26,Ignore the scrolling for the moment. How would the slender man move if everything else, except the player perhaps, was still? That tells you how to move it in real world coordinates.
I have checked the tutorial, it only shows how the scrolling works but now how to do the slender man.
So at any moment in time you know the player's real world position and that of the slender man. So you calculate the new position for the slender man based on that information. Once you have that you work out the on-screen position by adjusting with scrollx/y.
- Discussion Forums
- » Help with Scripts
- » Problem