Discuss Scratch

RubyG303
Scratcher
1 post

How do I make my sprites stay at the same place?

So, I’m making a project where you can run around and the map goes with you. (By making the map a sprite.) I made a few sprites, and also made them move with the map so they look like they’re in the same place. Then when they touch the edge, they hide themselves. When no longer touching the edge, they will show. However, if they hide then they will follow the new edge instead of staying where they were before. Does anybody know a way to get around this and make them stay at the same place on the moving map sprite, without adding them to the map sprite?

Last edited by RubyG303 (Nov. 8, 2022 01:44:52)

CaoLuan
Scratcher
39 posts

How do I make my sprites stay at the same place?

Try following one of the scrolling tutorials. What you are trying to do is to make a sprite scroll around the map (the actual sprite doesn't move but the rest of the backgrounds and other sprites do ), as a short explanation of what scrolling is to give you an idea: you're assigning a “position values” to all of the background sprites and they move base on that position values (as the position value will stay the same throughout)
TheWeeklyReader
Scratcher
100+ posts

How do I make my sprites stay at the same place?

you could have each object have a variable for x and y so like
when [w] key pressed
point in direction (0)
move (any) steps
change [object x] by (same amount moving)
change [object y] by (same amount moving)
forever
go to x: (my x position) y: (my y position)
end
this way so when the object goes like 300 pixels away, but can physically only be 200 away, it doesnt move closer when you move in that direction until it gets to the scratch screen border
cwkhero78353
New Scratcher
1 post

How do I make my sprites stay at the same place?

Good to know.

Powered by DjangoBB