Skip to content

Instantly share code, notes, and snippets.

@RoyCurtis
Created August 27, 2015 18:07
Show Gist options
  • Save RoyCurtis/e84cc8705a407f5c327f to your computer and use it in GitHub Desktop.
Save RoyCurtis/e84cc8705a407f5c327f to your computer and use it in GitHub Desktop.
Aoba avatar for FroJS
// To use this avatar, press F12 or open "Developer tools" in your browser.
// Then navigate to the "Console" tab, paste the entirety of this file, and press ENTER.
fro.player.setAvatar({
type: 'Animation',
autoplay: true,
// This URL should go to a spritesheet. Example:
// - Original FroJS avatar - "http://i.imgur.com/MAT9aD2.png"
// - Brendan Small (Large) - "http://i.imgur.com/tjkHVS0.png"
// - Brendan Small (Small) - "http://i.imgur.com/RFN6si6.png"
// - Maid - "http://i.imgur.com/PO1hFSM.png"
// - Aoba - "http://i.imgur.com/SOWJpVc.png"
url: "http://i.imgur.com/ugK4ZTE.png",
// The width and height of each frame. Frojs automatically caculates how wide and how
// tall the sprite sheet is based on this
width: 110,
height: 130,
keyframes: {
move_8: { // North moving - Walking left
// Whether this animation should loop or play once
loop: true,
// Each frame is a pair of numbers. For example [0, 1000]:
// - 0 is the frame number to use
// - 1000 is how long (in milliseconds) to stay in that frame
frames: [0, 10, 1, 10, 2]
},
move_4: { // West moving - Walking left
loop: true,
frames: [0, 10, 1, 10, 2]
},
move_6: { // East moving - Walking right
loop: true,
frames: [5, 10, 4, 10, 3]
},
move_2: { // South moving - Walking right
loop: true,
frames: [5, 10, 4, 10, 3]
},
stop_8: { // North resting - Face left
loop: false,
frames: [0, 1]
},
stop_4: { // West resting - Face left
loop: false,
frames: [0, 1]
},
stop_6: { // East resting - Face Right
loop: false,
frames: [5, 1]
},
stop_2: { // South resting - Face Right
loop: false,
frames: [5, 1]
},
act_8: { // CTRL+UP - Sit front
loop: false,
frames: [6, 1]
},
act_4: { // CTRL+LEFT - Sit front
loop: false,
frames: [6, 1]
},
act_6: { // CTRL+RIGHT - Sit front
loop: false,
frames: [6, 1]
},
act_2: { // CTRL+DOWN - Sit front
loop: false,
frames: [6, 1]
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment