Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » positioning glitch please help!!
- cavemanster
-
100+ posts
positioning glitch please help!!
hello! for my platformer it is vital that a sprite goes to X: 226 Y: 0 but it keeps going to 165 even when I write 226 it works with all other sprites just not this one. EDIT: (The problem is not that the sprite is off-center stop saying this it is coming up as the coordinate 165 no matter what I do)
Last edited by cavemanster (Oct. 29, 2019 08:56:08)
- mstone326
-
1000+ posts
positioning glitch please help!!
Check the center point of your sprite in the paint editor. If you look at this project you'll see that both sprites have the same coordinates but go to different areas because one sprite if off center. If that isn't the issue you need to share the project so we can see.
https://scratch.mit.edu/projects/290815365/
https://scratch.mit.edu/projects/290815365/
- deck26
-
1000+ posts
positioning glitch please help!!
Also remember Scratch prefers not to place sprite completely off-screen. If the costume is off centre to the right then placing it at x=226 might mean it is completely off screen and Scratch immediately changes it to a value that makes it partly visible (your 165 value). You'll probably also find you can set x to -300 which for most costumes would put a sprite off screen on the left and not be accepted.
Centre the costume to fix this.
Edit: - another indicator that this is what is happening is if you increase the size of the sprite it shouldn't need to move so far to appear on screen so the 165 would increase as well. Also the 165 would be the position for the current size for any alrger value of x so setting x to 300 gives the same result as setting it to 226 as in both cases the sprite is just moved to be on-screen.
Centre the costume to fix this.
Edit: - another indicator that this is what is happening is if you increase the size of the sprite it shouldn't need to move so far to appear on screen so the 165 would increase as well. Also the 165 would be the position for the current size for any alrger value of x so setting x to 300 gives the same result as setting it to 226 as in both cases the sprite is just moved to be on-screen.
Last edited by deck26 (Oct. 29, 2019 08:53:49)
- cavemanster
-
100+ posts
positioning glitch please help!!
this is not the problem, I understand this concept but the x actually says 156 it doesn't just not appear in the correct location. Check the center point of your sprite in the paint editor. If you look at this project you'll see that both sprites have the same coordinates but go to different areas because one sprite if off center. If that isn't the issue you need to share the project so we can see.
https://scratch.mit.edu/projects/290815365/
I answered the costume center issue as that is not the problem but some sprites have been allowed to go to the coordinate 226 and 156 is not far enough as only the edge of the sprite is hidden which is not good enough, if i cant solve this problem it will be a major issue in my game. Also remember Scratch prefers not to place sprite completely off-screen. If the costume is off center to the right then placing it at x=226 might mean it is completely off screen and Scratch immediately changes it to a value that makes it partly visible (your 165 value). You'll probably also find you can set x to -300 which for most costumes would put a sprite off screen on the left and not be accepted.
Centre the costume to fix this.
- deck26
-
1000+ posts
positioning glitch please help!!
You need to share the project and identify the sprite and costume if this is not fixing it.
- cavemanster
-
100+ posts
positioning glitch please help!!
ok https://scratch.mit.edu/projects/328797976/editor/ i will have to explain, to scroll to next level the clone of sprite appears in next frame form and scrolls onto the screen as the other one scrolls off the screen. to stop clone overflow it then appears where the clone is and the clone is deleted but the “obstacles” sprite which uses this code doesn't go to 226 on the x coordinate (btw the sprite is supposed to appear on the bottom left that's why the costume is not in the center
- cavemanster
-
100+ posts
positioning glitch please help!!
HOLY ****** IT SUDDENLY WORKED FOR NO REASON I DID NOTHING BUT NOW IT WORKS THANKS I GUESS IM UNSHARING NOW GOODBYE AND THANK YOU!
- cavemanster
-
100+ posts
positioning glitch please help!!
very strange it only works if i manually press
https://scratch.mit.edu/projects/328797976/editor/
Until it gets to the right location. resharing.
https://scratch.mit.edu/projects/328797976/editor/
Last edited by cavemanster (Oct. 29, 2019 09:11:28)
- cavemanster
-
100+ posts
positioning glitch please help!!
Edit: - another indicator that this is what is happening is if you increase the size of the sprite it shouldn't need to move so far to appear on screen so the 165 would increase as well. Also the 165 would be the position for the current size for any alrger value of x so setting x to 300 gives the same result as setting it to 226 as in both cases the sprite is just moved to be on-screen.
well it worked with all the other sprites fine so i dont know
- cavemanster
-
100+ posts
positioning glitch please help!!
Edit: - another indicator that this is what is happening is if you increase the size of the sprite it shouldn't need to move so far to appear on screen so the 165 would increase as well. Also the 165 would be the position for the current size for any alrger value of x so setting x to 300 gives the same result as setting it to 226 as in both cases the sprite is just moved to be on-screen.
well it worked with all the other sprites fine so i dont know
- cavemanster
-
100+ posts
positioning glitch please help!!
I have found a way around the glitch, not by fixing it but by accepting it and modifying my code around it. i guess i will never find a way to fix it but it is no longer a problem. thanks for helping!
- deck26
-
1000+ posts
positioning glitch please help!!
If you'd let us look at it we'd have resolved it for you. Modifying code around something you don't understand is not a good approach.
- LordOfLothlorien
-
1 post
positioning glitch please help!!
Hi are you still around? I'm having a similar problem. If you'd let us look at it we'd have resolved it for you. Modifying code around something you don't understand is not a good approach.
- ded_PC
-
100+ posts
positioning glitch please help!!
Please start an new post, I'm not sure if you know, but that is a necropost, which is a post to a inactive threadHi are you still around? I'm having a similar problem. If you'd let us look at it we'd have resolved it for you. Modifying code around something you don't understand is not a good approach.
Hope your x position is fixed!
- medians
-
1000+ posts
positioning glitch please help!!
Please create a new topic for this with the link to the project (make sure that it is shared).Hi are you still around? I'm having a similar problem. If you'd let us look at it we'd have resolved it for you. Modifying code around something you don't understand is not a good approach.
- Discussion Forums
- » Help with Scripts
-
» positioning glitch please help!!