Is there a block that sets mi Sprite to the bottom left of my canvas?
Or all other corners
Thanks
Is there a block that sets mi Sprite to the bottom left of my canvas?
Or all other corners
Thanks
Yes but you have to know the dimensions of the Sprite and Canvas to write the supporting code. There isn't a Block that does this automatically.
Start with
MoveTo(x,y) that moves the ImageSprite so that its left top corner is at the specified x
and y
coordinates.
and
MoveToPoint(coordinates) that moves the ImageSprite so that its origin is at the specified x and y coordinates.
See the documentation of ImageSprite Drawing and Animation
and Creating Animated Apps to learn how the Canvas works particularly Figure 17-2 and 17-6.
It would look something like this:
Sprite.MoveTo(Canvas.width-Sprite.width, Canvas.height-Sprite.height)
How to make my Sprite move in a direction until it's reaches the edge? Which block's ? Because I don't find a do loop block to make my Sprite move 1 pixel down until it touches the edge, and I don't find a block that make the Reaktion with the Edge.... I need all this
If you want to move the sprite to bottom/right edge when screen initialized, and your canvas height/width was set as 'fill parents', you will need a timer to wait a short time.
Ad There is a Reach Edge event, check the sprite block drawer carefully.
Because you have to code the blocks yourself. You did read Creating Animated Apps? Review Figure 17-12 and 17-13 which show how to do that with a Ball. Sprite is similar. Read the section on Creating Movement, then try something.
Ok, the first part I have solved.... I have tried the formula that give me the y (or the X) position in the edge.... But how I make the Sprite to step bi step to the edge, I need a thing like a loop that sums me +1 and then make the move, until it reaches the Edge... Thanks so much for your help, I learned so much with you here, thanks....
This formula: Sprite.MoveTo(Canvas.width-Sprite.width, Canvas.height-Sprite.height)
But my second Problem is not solved: how to move the Sprite step by step, dot by dot?
The clock don't works... It make an interval jes, but only in the last step , when the Sprite it's on its final step, but I need it step by step.... I need the data between, I need the steps between...
App Inventor need this "wait for X seconds block" (and I need it too)
Thanks
Use a Clock Timer to increment the X and Y or give the Sprite a Speed and Direction.
How to move a ball/sprite to a point (not so exactly) slowly :
Do not set the target ball/sprite visible to false, but set its color to None.
Jes I was readit , (backwards an forwards and all other direktions )and I was lucking YouTube, but it not works... the only thing what it does it's to move my sprite to the bottom left corner or edge... but in one step ... And I want to have the steps between....
I need the movement of the Sprite and I need it only in the screen initialisation,and I need the movement by 1 pixel in each step , and it must be slovly that I can see it, and understand it.... Excuse mi so much times in this question... And thanks for your big patientce,
What I was seen in your examples is the "call" block .
This is perhaps the solution ...
And I need only the y direction movement... And no need of buttons or other things... I will know only this one thing. (By the way,... I was make the same thing with Pocket code.... And scratch.... And tynker, and there it works ... ) But I need to make it with MIT App Inventor...
If you read the documentation for ImageSprite you will find:
Speed is the speed at which the ImageSprite
moves. The ImageSprite
moves this many pixels every Interval
milliseconds if Enabled
is true
.
You did read Creating Animated Apps?
Speed = 2 will move 2 pxiels . See the section on Speed.
Speed = 2 will move 2 pxiels . See the section on Speed.
Yes, I was try this,but it don't work,not in the designer view, and not by block's
And I was making the interval thing, and it don't work eather
the only thing that works is heading....
You understand now a little bit my Problem?
And repeadetly thanks for your help, I hope you find the solution, now that you know this issues
The solution is NOT to use a heading solution. See How do you auto position a Sprite to the bottom left corner? - #11 by SteveJG , did you try it?
Hello Steve, thanks so much, for your efforts....this is 1 step of my asked solution, I need this Funktion from "button click to step" or "button 1" , without button, and with a loop that do the movement by a loop, I don't know which type of possibilities/ loops are possible in M.A.I.
In Pocket code for example it's the "repeat until"
In scratch the same
In qbasic it was the " do loop until"
I need some thing like loop until the y = "hight of canvas" - "hight of sprite1/ ball1"
And then y = y + 1
So it reaches the south edge, but automatic( but step by step).