Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Sprite Going Through Black?
- JAVAProgramming
- Scratcher
100+ posts
Sprite Going Through Black?
Last edited by JAVAProgramming (Oct. 10, 2013 18:24:12)
My Newest Project, Come Check It Out
Dots, On Scratch
Want to change the way we count? The Dozenal System.
“The story so far:
In the beginning the Universe was created.
This has made a lot of people very angry and been widely regarded as a bad move.”
― Douglas Adams, The Restaurant at the End of the Universe
- drmcw
- Scratcher
1000+ posts
Sprite Going Through Black?
That's one of the common scrolling problems. Scratch doesn't let a sprite go completely off the screen even if the x, y coordinates you give it should make it go off. Various fixes are to add a border around the edge to cover the showing edges of sprites, detect when the x position is far enough over to then hide the sprite or adding transparent edges to the sprite so that the visible bits do go off stage. Find a scroller you like the look of and see how they do it for ideas.
- JAVAProgramming
- Scratcher
100+ posts
Sprite Going Through Black?
OK, thanks!! That's one of the common scrolling problems. Scratch doesn't let a sprite go completely off the screen even if the x, y coordinates you give it should make it go off. Various fixes are to add a border around the edge to cover the showing edges of sprites, detect when the x position is far enough over to then hide the sprite or adding transparent edges to the sprite so that the visible bits do go off stage. Find a scroller you like the look of and see how they do it for ideas.
My Newest Project, Come Check It Out
Dots, On Scratch
Want to change the way we count? The Dozenal System.
“The story so far:
In the beginning the Universe was created.
This has made a lot of people very angry and been widely regarded as a bad move.”
― Douglas Adams, The Restaurant at the End of the Universe
- scubajerry
- Scratcher
1000+ posts
Sprite Going Through Black?
I see you edited your post. I an not sure if you changed your question, but the previous answer doesn't appear to be related to your current question. In answer to this question, if you change your code to IF TOUCHING BLACK, SET Y VEL to 1, instead of the 0, you currently have takes care of most of your problems. It doesn't work with the “cave” that you currently have in your project. My sprite is going through the black.
Can anyone help me?
This game is here.
- JAVAProgramming
- Scratcher
100+ posts
Sprite Going Through Black?
What do you mean?I see you edited your post. I an not sure if you changed your question, but the previous answer doesn't appear to be related to your current question. In answer to this question, if you change your code to IF TOUCHING BLACK, SET Y VEL to 1, instead of the 0, you currently have takes care of most of your problems. It doesn't work with the “cave” that you currently have in your project. My sprite is going through the black.
Can anyone help me?
This game is here.
My Newest Project, Come Check It Out
Dots, On Scratch
Want to change the way we count? The Dozenal System.
“The story so far:
In the beginning the Universe was created.
This has made a lot of people very angry and been widely regarded as a bad move.”
― Douglas Adams, The Restaurant at the End of the Universe
- scubajerry
- Scratcher
1000+ posts
Sprite Going Through Black?
What do you mean?I see you edited your post. I an not sure if you changed your question, but the previous answer doesn't appear to be related to your current question. In answer to this question, if you change your code to IF TOUCHING BLACK, SET Y VEL to 1, instead of the 0, you currently have takes care of most of your problems. It doesn't work with the “cave” that you currently have in your project. My sprite is going through the black.
Can anyone help me?
This game is here.
Which part? The editing part, is because drmcw's answer is about what to do when your sprite gets near the edge of the screen.
As far as the code change, look at your code and you should see what I said.
- JAVAProgramming
- Scratcher
100+ posts
Sprite Going Through Black?
I tried that, and it doesn't work… He goes right through the black backgroundWhat do you mean?I see you edited your post. I an not sure if you changed your question, but the previous answer doesn't appear to be related to your current question. In answer to this question, if you change your code to IF TOUCHING BLACK, SET Y VEL to 1, instead of the 0, you currently have takes care of most of your problems. It doesn't work with the “cave” that you currently have in your project. My sprite is going through the black.
Can anyone help me?
This game is here.
Which part? The editing part, is because drmcw's answer is about what to do when your sprite gets near the edge of the screen.
As far as the code change, look at your code and you should see what I said.
My Newest Project, Come Check It Out
Dots, On Scratch
Want to change the way we count? The Dozenal System.
“The story so far:
In the beginning the Universe was created.
This has made a lot of people very angry and been widely regarded as a bad move.”
― Douglas Adams, The Restaurant at the End of the Universe
- scubajerry
- Scratcher
1000+ posts
Sprite Going Through Black?
Look at my remix. The only place it goes through the wall is the cave on the right. Is this what you are seeing?I tried that, and it doesn't work… He goes right through the black backgroundWhat do you mean?I see you edited your post. I an not sure if you changed your question, but the previous answer doesn't appear to be related to your current question. In answer to this question, if you change your code to IF TOUCHING BLACK, SET Y VEL to 1, instead of the 0, you currently have takes care of most of your problems. It doesn't work with the “cave” that you currently have in your project. My sprite is going through the black.
Can anyone help me?
This game is here.
Which part? The editing part, is because drmcw's answer is about what to do when your sprite gets near the edge of the screen.
As far as the code change, look at your code and you should see what I said.
- scubajerry
- Scratcher
1000+ posts
Sprite Going Through Black?
If you want more, you can look at http://scratch.mit.edu/projects/12194923/
- Discussion Forums
- » Help with Scripts
- » Sprite Going Through Black?