LONG SERIES OF HTML5 GAMES: chapter1 part9

Qaybta Xirfada Sayniska iyo iwm

Moderators: Moderators, Junior Moderators

User avatar
afisoone
SomaliNet Super
SomaliNet Super
Posts: 5509
Joined: Wed Jul 22, 2009 9:46 pm
Location: We all want to become president even though Amisom controls Mogadishu

LONG SERIES OF HTML5 GAMES: chapter1 part9

Post by afisoone »

Assalamu Caleykum,

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
function updateStageka()
{
window.requestAnimationFrame(updateStageka, canvaska);

arrow.x++;




if (arrow.x + arrow.width > canvaska.width)
{
arrow.x = canvaska.width - arrow.width;
}




hadbaSawir();


}
When the arrow comes from the left it will go to the end of the other side. and stops.

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.
How Do you add a background image to the canvaska?
We will answer in the next lesson. Inshallah!

<<Previous Lesson
  • Similar Topics
    Replies
    Views
    Last post

Return to “Careers - Engineering, Science & Computers”