Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of github.com:craftyjs/craftyjs.github.com
- Loading branch information
Showing
15 changed files
with
287 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
--- | ||
layout: tutorial | ||
title: Structure | ||
--- | ||
|
||
# Introduction | ||
|
||
What we will use in CraftyBoilerplate: | ||
|
||
* Crafty (latest release) | ||
* Modernizr (2.5.3) | ||
* Backbone (0.9.2) | ||
* Underscore (1.3.4) | ||
* RequireJquery | ||
|
||
To clean up the code and files, in this case we need to use backbone.js as wrapper for entities and require.js for loading files when requests. | ||
|
||
proposed structure tree: | ||
|
||
{% highlight html %} | ||
-- src | ||
---- components -> Crafty components files | ||
---- entities -> Files with entities | ||
-------- base | ||
------------ baseEntity.js -> Base entity | ||
---- interfaces -> We keep here files with interface entities | ||
---- levels -> Configuration files for levels | ||
---- scenes -> Files with scenes declarations | ||
---- windows -> Files with logic for interface windows | ||
---- libs -> Other libraries files | ||
-------- backbone | ||
-------- jquery | ||
-------- modernizr | ||
-------- require-jquery | ||
-------- underscore | ||
---- config.js -> Game configuration | ||
---- game.js -> Main file of the game | ||
---- sprites.js -> Sprites definitions | ||
-- web | ||
---- images | ||
-- index.html -> Game wrapper | ||
{% endhighlight %} | ||
|
||
You can find here (https://github.com/ahilles107/CraftyBoilerplate) a sample project that use CraftyBoilerplate. |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
layout: tutorial | ||
title: Add badge for user - Flexpi integration | ||
--- | ||
|
||
# Add badge for user | ||
|
||
* Add badges into your application using dashboard | ||
* Give user a badge | ||
{% highlight javascript %} | ||
// we have "userId" from FlexSocial integration. | ||
// get badge_id from your badges config in dashboard | ||
flex.badges.user.set(userId, badge_id, function(res){ | ||
// do something with res | ||
// console.log(res); | ||
}); | ||
{% endhighlight %} | ||
|
||
* Get Data about a badge and give user that badge. | ||
{% highlight javascript %} | ||
flex.badges.badge.get('badge_id', function(badgeData){ | ||
// do something with badge data in res | ||
// you will have object with badge_id, name, desc and image (url) | ||
// console.log(badgeData) | ||
}); | ||
{% endhighlight %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
layout: tutorial | ||
title: Custom data logging - Flexpi integration | ||
--- | ||
|
||
# Custom data logging with FlexStats | ||
|
||
* Define variables for FlexStats in your app (in dashboard) | ||
* Place the following code in the place where you want login variable: | ||
|
||
{% highlight javascript %} | ||
flex.stats('your defined app key', 'your value to log', function(res){ | ||
// response with status and status message | ||
}); | ||
{% endhighlight %} | ||
|
||
For example: | ||
|
||
{% highlight javascript %} | ||
entity | ||
.onHit('ufo', function(e){ | ||
flex.stats('ufo-crashed', 'Ufo was crashed at a height of '+entity.h+'.', function(res){ | ||
// response with status and status message | ||
}); | ||
} | ||
{% endhighlight %} |
Oops, something went wrong.