Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Scrolling Game (2)
- ApophisOfficial
-
2 posts
Scrolling Game (2)
Hello,
I'm working on a scrolling space game and need help with a few mechanics:
1. Finding width:
I have objects in space, like moons and planets, and want them to hide when off-screen. So is there any way to use a script to get the width and height of a clone?
2. Camera Lag Effect:
If the player is always at the center of the screen, it can feel like they're not moving. Instead, I want the camera to slightly lag behind the player.
The camera should have a delayed response when the player starts moving and catch up when they stop, so movement feels smoother and more dynamic.
Any advice on how to implement these? Thanks in advance!
I'm working on a scrolling space game and need help with a few mechanics:
1. Finding width:
I have objects in space, like moons and planets, and want them to hide when off-screen. So is there any way to use a script to get the width and height of a clone?
2. Camera Lag Effect:
If the player is always at the center of the screen, it can feel like they're not moving. Instead, I want the camera to slightly lag behind the player.
The camera should have a delayed response when the player starts moving and catch up when they stop, so movement feels smoother and more dynamic.
Any advice on how to implement these? Thanks in advance!
- kemoCyan
-
24 posts
Scrolling Game (2)
I can help you with hiding objects off-screen, you can basically make a border around the screen that doesn't move and is always on the front layer so that it hides things that are off-screen/stuck to the edge, it's kinda annoying because it makes the screen even smaller
or you can just use a block I use in my scrolling platformers so that I don't have to use a border:
or you can just use a block I use in my scrolling platformers so that I don't have to use a border:
define check
set [ghost] effect to (0)
set [prev pos] to (x position)
change x by (1)
if <(x position) = (prev pos)> then
set [ghost] effect to (100)
end
change x by (-2)
if <(x position) = (prev pos)> then
set [ghost] effect to (100)
end
change x by (1)
set [prev pos] to (y position)
change y by (1)
if <(y position) = (prev pos)> then
set [ghost] effect to (100)
end
change y by (-2)
if <(y position) = (prev pos)> then
set [ghost] effect to (100)
end
change y by (1)
- Discussion Forums
- » Help with Scripts
-
» Scrolling Game (2)