LONG SERIES OF HTML5 GAMES: chapter1 part8
Posted: Fri May 22, 2015 9:09 pm
Now the hardest part went. Everything else is easy..
Now let's answer what is screen wrapping?
Screen wrapping is when an image disappears one side and reemerges on the opposite side. That is what is called screen wrapping. ok
How do you do that in this arrow image... We need to add some codes functionka updateStageka();
open your Object.js file and let add some codes on updateStageka. Since our arrow image is running left to right we are going to add this
simple code..
anagoo ku dhahnay
So now the image reappears again when it finishes the other end... Beautiful
---------------------------------------------------------------------------------------------------------------------
Here is the another question. Why the arrow Image is crossing the left of the canvaska.
How do we stop it?
We will next lesson inshallah!
<<Previous Lesson
Now let's answer what is screen wrapping?
Screen wrapping is when an image disappears one side and reemerges on the opposite side. That is what is called screen wrapping. ok
How do you do that in this arrow image... We need to add some codes functionka updateStageka();
open your Object.js file and let add some codes on updateStageka. Since our arrow image is running left to right we are going to add this
simple code..
Beautiful: Now what we said is simple. If the canvaska haduu dhaafo imageka. Then So gali the arrow image from the other side.function updateStageka()
{
window.requestAnimationFrame(updateStageka, canvaska);
arrow.x++;
if(arrow.x>canvaska.width)
{
arrow.x=0-arrow.width;
}
hadbaSawir();
}
anagoo ku dhahnay
Soo now let's watch what we did..here is the Demoarrow.x=0-arrow.width;
So now the image reappears again when it finishes the other end... Beautiful
---------------------------------------------------------------------------------------------------------------------
Here is the another question. Why the arrow Image is crossing the left of the canvaska.
How do we stop it?
We will next lesson inshallah!
<<Previous Lesson