I see that this student did not structure this activity as the example shows and as I have been teaching, but I don’t see logically why it won’t work. If the ‘setFlyer’ function is called at the beginning of the draw function, shouldn’t that give the sprite its velocityX = -5 so that it will start moving? Thanks for any insight on this as I don’t see why it matters if the setFlyer function runs before the draw function to start the game or just inside the draw function to start the game.
Every time you run the setFlyer function, it reinitializes the x and y value of the flyer. So, it runs, it sets the position of the flyer and then it sets the velocity. Before the velocity can move the flyer, the setFlyer function runs again and repositions the flyer back to it’s starting point. This happens over and over and over again so even though it has a velocity, the millisecond that it kicks in, the setFlyer function puts the flyer back in it’s start position.
Hope this makes sense!