Commit 17bdfcc7 authored by Matthew Odle's avatar Matthew Odle

add image animations

parent e53ac975
......@@ -10,7 +10,7 @@ var knobsAndLevers = {
this.spider.init(this);
this.text.init(this);
this.worms.init(this);
console.log("knobsAndLevers initialized");
console.log('knobsAndLevers initialized');
},
resetCheats : function() {
this.laser.resetCheats();
......@@ -48,18 +48,16 @@ var knobsAndLevers = {
y : 0,
extraArgs : {
hitPoints : 1,
type : "centipede",
type : 'centipede',
images : {
last : 0,
objects : {
up : [{filename : 'centipede-head-1-up.png'}],
down : [{filename : 'centipede-head-1-down.png'}],
left : [{filename : 'centipede-head-1-left.png'}],
right : [{filename : 'centipede-head-1-right.png'}],
},
select : function(obj) {
let key = customComponents.getCentipedeDirection(obj);
return this.objects[key][this.last].image;
getKey : function(obj) {
return customComponents.getCentipedeDirection(obj);
},
},
},
......@@ -89,14 +87,12 @@ var knobsAndLevers = {
type : 'fly',
speed : {x : 0, y : 2},
images : {
last : 0,
animationInterval : 50,
objects : {
one : [{filename : 'flea-1.png'}],
two : [{filename : 'flea-2.png'}],
one : [{filename : 'flea-1.png'}, {filename : 'flea-2.png'}],
},
select : function(obj) {
let key = 'one';
return this.objects[key][this.last].image;
getKey : function(obj) {
return 'one';
},
},
},
......@@ -173,8 +169,8 @@ var knobsAndLevers = {
},
interval : 10,
args : {
color : "purple",
extraArgs : {type : "laser", speed : {x : 0, y : 0}},
color : 'purple',
extraArgs : {type : 'laser', speed : {x : 0, y : 0}},
},
init : function(configs) {
this.args.width = configs.general.gridSquareSideLength / 10;
......@@ -195,7 +191,6 @@ var knobsAndLevers = {
hitPoints : 4,
type : 'mushroom',
images : {
last : 0,
objects : {
normal1 : [{filename : 'mushroom-1.png'}],
normal2 : [{filename : 'mushroom-2.png'}],
......@@ -206,9 +201,8 @@ var knobsAndLevers = {
poisoned3 : [{filename : 'mushroom-poisoned-3.png'}],
poisoned4 : [{filename : 'mushroom-poisoned-4.png'}],
},
select : function(obj) {
let key = (obj.poisoned ? 'poisoned' : 'normal') + obj.hitPoints;
return this.objects[key][this.last].image;
getKey : function(obj) {
return (obj.poisoned ? 'poisoned' : 'normal') + obj.hitPoints;
},
},
},
......@@ -231,14 +225,12 @@ var knobsAndLevers = {
type : 'player',
speed : {x : 0, y : 0},
images : {
last : 0,
objects : {
player1 : [{filename : 'player1.png'}],
player2 : [{filename : 'player2.png'}],
},
select : function(obj) {
let key = obj.name ? obj.name : 'player1';
return this.objects[key][this.last].image;
getKey : function(obj) {
return obj.name ? obj.name : 'player1';
},
},
},
......@@ -289,17 +281,15 @@ var knobsAndLevers = {
args : {
extraArgs : {
hitPoints : 1,
type : "spider",
type : 'spider',
speed : {x : 1, y : 1},
images : {
last : 0,
animationInterval : 50,
objects : {
one : [{filename : 'spider-1.png'}],
two : [{filename : 'spider-2.png'}],
one : [{filename : 'spider-1.png'}, {filename : 'spider-2.png'}],
},
select : function(obj) {
let key = 'one';
return this.objects[key][this.last].image;
getKey : function(obj) {
return 'one';
},
},
},
......@@ -349,19 +339,18 @@ var knobsAndLevers = {
args : {
extraArgs : {
hitPoints : 1,
type : "worm",
type : 'worm',
speed : {x : 0.5, y : 0},
images : {
last : 0,
animationInterval : 50,
objects : {
leftcrazy : [{filename : 'worm-left-crazy.png'}],
rightcrazy : [{filename : 'worm-right-crazy.png'}],
leftnormal : [{filename : 'worm-left-normal.png'}],
rightnormal : [{filename : 'worm-right-normal.png'}],
leftcrazy : [{filename : 'worm-1-left-crazy.png'}],
rightcrazy : [{filename : 'worm-1-right-crazy.png'}],
leftnormal : [{filename : 'worm-1-left-normal.png'}, {filename : 'worm-2-left-normal.png'}],
rightnormal : [{filename : 'worm-1-right-normal.png'}, {filename : 'worm-2-right-normal.png'}],
},
select : function(obj) {
let key = (obj.speedX > 0 ? 'right' : 'left') + obj.imageType;
return this.objects[key][this.last].image;
getKey : function(obj) {
return (obj.speedX > 0 ? 'right' : 'left') + obj.imageType;
},
},
},
......
app/static/media/images/flea-2.png

1.13 KB | W: | H:

app/static/media/images/flea-2.png

579 Bytes | W: | H:

app/static/media/images/flea-2.png
app/static/media/images/flea-2.png
app/static/media/images/flea-2.png
app/static/media/images/flea-2.png
  • 2-up
  • Swipe
  • Onion skin
app/static/media/images/spider-1.png

749 Bytes | W: | H:

app/static/media/images/spider-1.png

1.07 KB | W: | H:

app/static/media/images/spider-1.png
app/static/media/images/spider-1.png
app/static/media/images/spider-1.png
app/static/media/images/spider-1.png
  • 2-up
  • Swipe
  • Onion skin
app/static/media/images/spider-2.png

686 Bytes | W: | H:

app/static/media/images/spider-2.png

878 Bytes | W: | H:

app/static/media/images/spider-2.png
app/static/media/images/spider-2.png
app/static/media/images/spider-2.png
app/static/media/images/spider-2.png
  • 2-up
  • Swipe
  • Onion skin
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment