Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
OutRed
GitHub Repository: OutRed/Cuphead-webgame
Path: blob/main/js/animation.js
139 views
1
function initAnim(subj, animSet) {
2
subj.currentPick = 0;
3
subj.speedTick = 23;
4
5
subj.animSet = animSet;
6
subj.chosenAct = "run";
7
subj.frame = 1;
8
}
9
10
//Function of basic animation
11
function basicAnim(subj)
12
{
13
if(subj.frame > subj.maxFrame)
14
subj.frame = 1;
15
16
subj.chosenPath = subj.path + stdizeCount(subj.frame) + '.png';
17
makeImage(subj.chosenPath, subj.x, subj.y, subj.width, subj.height, subj.flip);
18
19
if(subj.currentPick < subj.speedTick)
20
{
21
subj.currentPick += 7;
22
return;
23
}
24
else if(subj.currentPick >= subj.speedTick)
25
subj.currentPick = 0;
26
27
if(subj.frame > subj.maxFrame)
28
subj.frame = 1;
29
else
30
subj.frame++;
31
}
32
33