Pages: 1
Topic closed
Okay, so here is what i need your guys help with.
I have a bar that scrolls, there are two total terrains for the bar. I need a red block to stay in one spot, but when the game starts that spot cannot be seen. To see it you have to scroll over to it.
I need help creating a code that will make the block stay in one spot.
If anyone wants to see what i have so far,
http://scratch.mit.edu/projects/Nano511/1558818
and for those who are interested in what i had originally,
http://scratch.mit.edu/projects/Nano511/1557608
Offline
You should be able to determine an offset by adjusting scollX so that the object (at x position 0) is where you want it on the terrain. Then you can use this script:
When green flag clicked Forever Set x to ((the number you just found) * -1) + scrollX If x > -239 and x < 239 Show Else Hide End If End Forever
Last edited by Harakou (2011-01-26 16:26:04)
Offline
Offline
Harakou wrote:
You should be able to determine an offset by adjusting scollX so that the object (at x position 0) is where you want it on the terrain. Then you can use this script:
Code:
When green flag clicked Forever Set x to ((the number you just found) * -1) + scrollX If x > -239 and x < 239 Show Else Hide End If End Forever
I dont really understand your first sentence. And could you explain the script better so i can adjust it to what i need?
Offline
Nano511 wrote:
Harakou wrote:
You should be able to determine an offset by adjusting scollX so that the object (at x position 0) is where you want it on the terrain. Then you can use this script:
Code:
When green flag clicked Forever Set x to ((the number you just found) * -1) + scrollX If x > -239 and x < 239 Show Else Hide End If End ForeverI dont really understand your first sentence. And could you explain the script better so i can adjust it to what i need?
Sorry. Here's what you need to do:
1. Set the object's x position on the stage to 0. (So it is right in the middle of the screen)
2. Keep adjusting the scrollX variable until the terrain is lined up properly with the object. (For example, if you need to have you object on a chair, adjust scrollX until the object is at the same place as the chair.)
3. Now use the current scrollX value in the script I just gave you.
Hope that cleared things up.
Offline
Topic closed
Pages: 1