Doing a Little Review

     Today, I worked on making a gif move. The work I am doing is a little review from last semester. If y'all can't remember, last semester I worked on making a little character move north, south, east, and west. I enjoyed working on my gif move all of these directions. Although, Instead of a little human character, this time we are using Link (A character from the Legend of Zelda).
     First I started with a setInterval function. This function held the if statement, that if the direction is == (== is used to compare and not to assign something) to 'right', + 1px to the character's.left attribute. The 1px means to add 1px to where Link is located on the canvas. For example, if Link is assigned '200px' to the left attribute, which is otherwise the x-axis; then adding 1px makes it so the '200px' will keep increasing by one. This means the character will start to move to the right. To make Link go left, one just needs to add -1px . If one wanted to make link go up or down, they would do the same thing they did by adding 1px to the left attribute, but now adding 1px to the top attribute. The top attribute is essentially the y-axis. I was running into some trouble when trying to make Link change from the static gif when I wanted him to walk in a different direction. I plan to work on this next week at my internship. Soon it was time to head back to the school.

Comments

Popular posts from this blog

Making Classes

Using the Arrow Keys