JS: Animation Frame
Get to know how animation frames are set for games.
It’s better to set the animation frames of the game before creating or moving the character. Our character object will move and update its position, so we need to update frames constantly.
Model Object
Let’s first define a model object which will be containing some standard values like
gravity
.force
.groundforce
.ground
.
It will be accessed whenever those values would be needed.
Press + to interact
// define modelconst model = {gravity: 0.2,force: 0.999,groundforce: 0.9,ground: 400,}
Setting frames
Let’s define a ...
Create a free account to view this lesson.
By signing up, you agree to Educative's Terms of Service and Privacy Policy