2016년 12월 10일 토요일

"Call (sprite). MoveTo" block will not move sprite. So confused.....


So I'm trying to simply set the coordinates for a sprite to go to, but after trying everything nothing is happening. The code simply does this. When I press button1, the background changes, the sprite appears and is send to the coordinates (200,1). When I do press the button, the background changes and the sprite appears, but it stays at (1,1). I have tried using the "Set sprite X to" command as well but it will not work either. Furthermore, if i right click the block and press "do it" the sprite DOES move to the specified coordinates. I have no clue why it will not work in the program. Please help....

*btw I've played with the switching the last two blocks as well (the "MoveTo" and "Set visible" blocks) but it does not affect anything..

-- 
do you need the 2 blocks Canvas.WidthPercent and Canvas.HeightPercent in the Button.Click event?
you might want to move them to the Initialize event and try again

-- 
Wow it worked. Why is it that those blocks affect it? I just started using App Inventor. Those two blocks probably aren't necessary I just put them there because I thought they might be. Thank you

-- 
this is a timing issue
after changing the canvas size you have to wait little bit before moving the sprite
Please Wait method by Scott


-- 

댓글 없음:

댓글 쓰기