]> git.plutz.net Git - isotilejs/blobdiff - index.html
cleaner animation stepping
[isotilejs] / index.html
index 0debcfaf1aebbf8870b4802262c4068ab4e27c53..76bd4b2f2a8c5c2b0b8a012050ecf1d1e3d190e5 100644 (file)
@@ -6,7 +6,7 @@
   <canvas id="view" width="1280" height="600" style="padding: 0 auto; max-height: 600px;">
     Canvas not supported<br/>
     <img id="maptiles" src="tileset.png" width="64" style="overflow: hidden;"  />
-    <img id="character" src="character.png" speed="4"/>
+    <img id="character" src="character.png" speed="2.75"/>
     <div id="map" columns="18" rows="36">
       5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
       5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
@@ -175,6 +175,14 @@ player = {
       case 'sw': dy =  .45 * this.speed; dx = -.9 * this.speed; break;
       case 'se': dy =  .45 * this.speed; dx =  .9 * this.speed; break;
     }
+
+    if (player.frame % 6 > 2) {
+      dx *= 1.375;
+      dy *= 1.375
+    } else {
+      dx *= .625;
+      dy *= .625;
+    }
   
     if (map.data[map.tile_at(this.x + dx, this.y + dy)] != 4) {
       this.x += dx; this.y += dy;