Xagee qaxweynta noo mareeysay. Oh waxey noo joogtay inaan soo baranay screeen wrapping. Now how to set and stop at the boundaries for that arrow image.
Ok. Now let' edit again updateStageka ee filekii aan soo suubisanay Object.js
And put this
When the arrow comes from the left it will go to the end of the other side. and stops.function updateStageka()
{
window.requestAnimationFrame(updateStageka, canvaska);
arrow.x++;
if (arrow.x + arrow.width > canvaska.width)
{
arrow.x = canvaska.width - arrow.width;
}
hadbaSawir();
}
We test if the arrow x iyo balaciisa haduu ka badnaado balaca canvaska. Then stop.
We stop
arrow.x=canvaska.width -arrow.width
Ok let's live what we did... Demo Boundaries stop
Now what?
Let me ask you a question. Now we know how to add an arrow image to the canvaska.
We will answer in the next lesson. Inshallah!How Do you add a background image to the canvaska?
<<Previous Lesson