24
ame Development With Butterfly Framework Do It Yourself Introduction To Butterfly Framewor By Chanaka Nakandala

Html5 game development

Embed Size (px)

Citation preview

Page 1: Html5  game development

Game Development With Butterfly FrameworkDo It Yourself

Introduction To Butterfly Framework

ByChanaka Nakandala

Page 2: Html5  game development

Game Development With Butterfly FrameworkDo It Yourself

What is Butterfly Framework..?

Butterfly Framework is a Framework Provided by ButterflySoft PVT(LTD.) For HTML5 game development tasks.

That mean Butterfly Framework is not a “Game Engine” , It’s a “Code library”.

Butterfly Framework is build on top of the HTML5 Canvas.

Page 3: Html5  game development

Core Frameworks

Graphics Audio Input Math

Page 4: Html5  game development

Butterfly Framework For HTML5 v1.0.0

Features

Page 5: Html5  game development

Cross BrowserFeatures

What are those Web Browsers..?Microsoft Internet Explorer

Mozilla Firefox

Google Chrome

Apple Safari

Google Chrome Frame for Internet Explorer

Page 6: Html5  game development

GraphicsFeatures

2D Sprites Helper for render 2D Graphics and Sprite Sheets.

Enable to using Viewport Effects.

Page 7: Html5  game development

InputsFeatures

Easy to getting User Inputs

1.Mouse2.Keyboard

Provides

Page 8: Html5  game development

AudioFeatures

Game audio is Based on Background Music and Sound FXs.

Able to use audio files via their logical names

Support For mp3 and wav formats

Support for Looping , Pause and MemoryManagement

Page 9: Html5  game development

MathFeatures

Support for Vector and Rectangles

Intersection Helpers

Movement Helpers

Allows to use Javascript Math

Page 10: Html5  game development

How to develop a game Butterfly Framework.?

You may needs

1. butterflyframework.js

2. Game.js

Page 11: Html5  game development

How to develop a game Butterfly Framework.?

You may needsHTML5 Support Web Browser

Page 12: Html5  game development

Butterfly Framework has some sequence of built in methods

i. Initializeii. Load Game Assetsiii. Updateiv. Draw Game On The Screenv. Exit Game

Life Cycle Of Butterfly Framework.?

Page 13: Html5  game development

Life Cycle Of Butterfly Framework.?Do It Yourself

Initialize Load Game Assets Update

Draw Game On The Screen

Exit

Page 14: Html5  game development

Butterfly Framework For HTML5 v1.0.0

Develop Games WithButterfly Framework

Page 15: Html5  game development

Steps

1.Create New HTML 5 Page

2.Include Framework inside of the HTML page

Page 16: Html5  game development

<!DOCTYPE html><html> <head> <title>Butterfly Soft</title> <link rel="icon" href="Butterfly_Framework/favicon.gif" type="image/x-icon"> <style> body { margin:0px; padding:0px; }

canvas{ outline:0; border:1px solid #000; margin-left: auto; margin-right: auto; } </style> </head>

<body> <canvas id='graphicDevice'></canvas> <script src="Butterfly_Framework/butterflyframework.js"></script> <script src="Game.js"></script> </body></html>

Page 17: Html5  game development

Content Includes All Game Assets…

Game Contents

Textures , Sprites,Music Tracks , Sound Effects,Game Level Data

Page 18: Html5  game development

Butterfly Framework For HTML5 v1.0.0

Introduction Game.js

Page 19: Html5  game development

Life Cycle Of Butterfly Framework.?Do It Yourself

Initialize Load Game Assets Update

Draw Game On The Screen

Exit

Page 20: Html5  game development

Initialize Method

//----------------------------initialization------------------

var Initialize = function(){ // TODO: Add your initialization logic here}Initialize();

Game.js

Page 21: Html5  game development

LoadContent Method//----------------------------Load Content------------------------

var LoadContent = function(){

// TODO: use this to load your game content here

}LoadContent();

Game.js

Page 22: Html5  game development

Update Method

//---------------------------Update-------------------------------------

var Update= function(){

document.onkeydown = function(e) { if(e.keyCode==27){ window.close();//exit when press esc } }

// TODO: Add your update logic here

}

Game.js

Page 23: Html5  game development

Draw Method

//---------------------------Draw---------------------------------------

var Draw= function(){ clear('#d5e7f9');

// TODO: Add your drawing code heres

}

Game.js

Page 24: Html5  game development

Feedback

[email protected]