1. Original Update byJacek.NL
(http://www.?ickr.com/photos/jacek_nl/)
TitaniumQuickTiGame2dでの
シュ`ティングゲ`ムのつくりかた
(How to create a shooting game w/ QuickTiGame2d)
12定3埖24晩輿袗晩
2. Agenda
? my self-introduce (5min)
? How to create a shooting game w/
QuickTiGame2d (30min)
? Q&A (5min)
12定3埖24晩輿袗晩
3. my self-introduce
non-developer
*Recruiter for Web developer/designer
12定3埖24晩輿袗晩
4. my self-introduce
2 years experience:Windows + JScript
1.5 years experience:Titanium Mobile
12定3埖24晩輿袗晩
5. my self-introduce
this blog trigger for me to learn
Titanium Mobile
12定3埖24晩輿袗晩
9. Easy to create a shooting
game w/ QuickTiGame2d
12定3埖24晩輿袗晩
10. What s QuickTiGame2d
? Game engine for Titanium Mobile developed by Kota Iguchi
? latest version supports tiled map integration,Box2d physics... and
so on.
? You can download it here(http://code.google.com/p/
quicktigame2d/)
2011/12/28 2012/1/8
12定3埖24晩輿袗晩
11. Which QuickTiGame2d API is used in this
sample application?
GameView Scene Sprite
Original Update by jcarbaugh Original Update by John Kroll
Original Update by Daves Portfolio
http://www.?ickr.com/photos/jcarbaugh/ http://www.?ickr.com/photos/jkroll/
http://www.?ickr.com/photos/daves_portfolio/
12定3埖24晩輿袗晩
12. Each QuickTiGame2d API overview
Scene Sprite
Ti.UI.Window
GameView
`onload¨ event :
-initiazlie & game start
`enterFrame¨ event:
-redraw all sprites
-check if enemies and bullets intersect
`touchmove¨ event :
-move tank to the left or right
12定3埖24晩輿袗晩
13. ここから3つのステップに蛍けて
恬り圭盾hします
Original Update byjeezny
(http://www.?ickr.com/photos/jeezny/)
12定3埖24晩輿袗晩
27. enterframeEvent?
^enterframe event is fired Example
on every time the view
starts to draw the frame. ̄
Speed=10 Speed=50 Speed=100
0 Y:-100 Y:-100 Y:-100
1sec Y:-90 Y:-50 Y:0
2sec Y:-80 Y:0 Y:100
3sec Y:-70 Y:50 Y:200
12定3埖24晩輿袗晩
28. As a result
Speed=10 Speed=50 Speed=100
12定3埖24晩輿袗晩
29. STEP3-2
function updateAliensPosition(){
for (var i = 0; i <5; i++) {
aliens[i].y += aliensSpeed[i] * Math.random();
if(aliens[i].y > 480){
aliens[i].y = -100;
}
}
}
function updateBulletPosition(){
for (var i = 0; i < 10; i++) {
bullets[i].y -= bulletsSpeed[i];
if(bullets[i].y < 0 || bullets[i].y > 480){
bullets[i].x = initBulletsPostion();
bullets[i].y = tank.y - (bullets[i].height);
}
}
}
12定3埖24晩輿袗晩
30. STEP3-3
// Check if enemies and bullets intersect
function bulletCollidesWithAliens(){
for (var i = 0; i < 10; i++) {
for(var j=0;j<5;j++){
var flg = bullets[i].collidesWith(aliens[j]);
if(flg){
totalScore +=100;
scoreLabel.text = ('Score:' + totalScore);
aliens[j].y = -100;
// reset bullet poition on gun of tank
bullets[i].x = initBulletsPostion();
bullets[i].y = tank.y - (bullets[i].height);
}
}
}
}
12定3埖24晩輿袗晩
31. おまけ坤鴬`ム佃叟業譜協
? y叟業について
var gameLevel ={
? オ世諒、堀業や easy:{
MAXALIENS :5,
の方、卞咼好圦`ド MAXBULLETS :15,
ALIENSSPEED:10,
といったパラメ`タ BULLETSSPEED:15
を筝でgF辛嬬 },
hard:{
? マジックナンバ`契峭 MAXALIENS :10,
MAXBULLETS :10,
ALIENSSPEED:15,
? それぞれのスプライ BULLETSSPEED:10
}
トに岷俊、鰓O協し };
てしまうと尖盾でき var selectedLevel = 'easy';
function initAliens(){
なくなる辛嬬來寄 var counter = gameLevel[selectedLevel].MAXALIENS;
for (var i = 0; i < counter; i++) {
? こんな湖じにしてお
くと措いかも★
12定3埖24晩輿袗晩