SlideShare a Scribd company logo
1 of 33
Download to read offline
cocos2d使ってみました!
山平 誠
(開発者名:makohira)
2013年3月16日
©makohira2013
目次
自己紹介
アプリの紹介
cocos2dとTiledMap
最後に
©makohira2013
自己紹介
名前:山平誠
住所:愛知県尾張旭市
 facebook.com/Makoto.Yamahira
 @makohira
普段の仕事:業務系SE
家で:スマホアプリ開発
趣味:英語、飲み会、カラオケ・・・
©makohira2013
2013年2月15日
「英文法クエスト」
をリリースしました。
(2本目のアプリです。)
アプリの紹介
©makohira2013
英文法クエストは
ロールプレイングゲーム形式
の英文法学習アプリです。
©makohira2013
画面は
こんな感じ。
©makohira2013
cocos2dとTiledMap
今回の開発では
①cocos2d-iphone
②TiledMap
にかなり助けられました。
©makohira2013
cocos2d-iphone
アニメーションの実装がラク。
パーティクル効果の実装がラク。
TiledMapの実装がラク。
◎良かった点
©makohira2013
◎アニメーションの実装がラク。
// 5秒かけて右に50ピクセル移動。
[someObject runAction:[CCMoveBy actionWithDuration:5.0f
position:CGPointMake(50, 0)]];
©makohira2013
◎アニメーションの実装がラク。
// 5秒かけて右に50ピクセル移動。
[someObject runAction:[CCMoveBy actionWithDuration:5.0f
position:CGPointMake(50, 0)]];
1行で書けます。
©makohira2013
◎パーティクル効果の実装がラク。
①ParticleDesignerでパーティクルを作成し
cocod2d(plist)形式で保存する。
ParticleDesigner
©makohira2013
②保存したファイルをプロジェクトに追加し、
次のようなコードを書く。
// パーティクルの実装
CCParticleSystemQuad *particle =
[CCParticleSystemQuad particleWithFile:@"test_particle.plist"];
[self addChild:particle];
©makohira2013
②保存したファイルをプロジェクトに追加し、
次のようなコードを書く。
// パーティクルの実装
CCParticleSystemQuad *particle =
[CCParticleSystemQuad particleWithFile:@"test_particle.plist"];
[self addChild:particle];
2行で書けます。
©makohira2013
②保存したファイルをプロジェクトに追加し、
次のようなコードを書く。
// パーティクルの実装
CCParticleSystemQuad *particle =
[CCParticleSystemQuad particleWithFile:@"test_particle.plist"];
[self addChild:particle];
実行結果
2行で書けます。
©makohira2013
◎TiledMapの実装がラク。
後で説明します。。
©makohira2013
cocos2d-iphone
書籍が少ない。
×悪かった点
©makohira2013
◎書籍が少ない。
cocos2d関係の書籍が少なかったです。
古い書籍はcocos2dの古いバージョン
を使っていたりするので読み解くのが大変でした。
©makohira2013
私は次の3つの書籍で勉強しました。
①cocos2dでつくるiPhoneゲーム(工学社)
②Learn cococ2d 2 Game Development for iOS(Apress)
③cocos2dで作る iPhone&iPadゲームプログラミング(インプレスジャパン)
©makohira2013
私は次の3つの書籍で勉強しました。
①cocos2dでつくるiPhoneゲーム(工学社)
②Learn cococ2d 2 Game Development for iOS(Apress)
③cocos2dで作る iPhone&iPadゲームプログラミング(インプレスジャパン)
最新版に対応しており、
分かりやすいが
情報量が少し足りない。
©makohira2013
私は次の3つの書籍で勉強しました。
①cocos2dでつくるiPhoneゲーム(工学社)
②Learn cococ2d 2 Game Development for iOS(Apress)
③cocos2dで作る iPhone&iPadゲームプログラミング(インプレスジャパン)
最新版に対応しており、
分かりやすいが
情報量が少し足りない。
最新版に対応しており、
情報量も十分あるが
英語で書かれている。
©makohira2013
私は次の3つの書籍で勉強しました。
①cocos2dでつくるiPhoneゲーム(工学社)
②Learn cococ2d 2 Game Development for iOS(Apress)
③cocos2dで作る iPhone&iPadゲームプログラミング(インプレスジャパン)
最新版に対応しており、
分かりやすいが
情報量が少し足りない。
最新版に対応しており、
情報量も十分あるが
英語で書かれている。
左の書籍の日本語版だが、
cocos2dの最新版に
対応していない。
©makohira2013
TiledMap
マップ用のチップを作成。
テクスチャを作成。
Tiled Mapを作成。
cocos2dを使うと実装がラク。
©makohira2013
◎マップ用のチップを作成。
画像編集ソフトなどでチップを作ります。
©makohira2013
◎テクスチャを作成。
TexturePackerというソフトを使いました。
複数のチップ用画像を1枚の画像にしてくれます。
cocos2d用のplistファイルも自動で作ってくれます。
TexturePacker
©makohira2013
◎Tiled Mapを作成。
Tiled Map Editor(Tiled Qt)
というフリーソフトを使いました。
Tiled Qt
タイルレイヤーとオブジェクトレイヤー
という2種類のレイヤーが結構使えました。©makohira2013
Tiled Qtで保存したファイルは拡張子が(.tmx)
というものになります。
このファイルはcocos2dでそのまま利用することができます。
©makohira2013
tmxファイル、マップチップ用の画像ファイル、マップチ
ップ用のplistファイルをプロジェクトに追加し、
次のようなコードを書く。
// TiledMap用のチップ画像の準備
CCSpriteFrameCache *frameCache =
[CCSpriteFrameCache sharedSpriteFrameCache];
[frameCache addSpriteFramesWithFile:@"map_items.plist"];
// TiledMapの表示
CCTMXTiledMap *tiledMap =
[CCTMXTiledMap tiledMapWithTMXFile:@"field_map.tmx"];
[self addChild:tiledMap];
◎cocos2dを使うと実装がラク。
©makohira2013
tmxファイル、マップチップ用の画像ファイル、マップチ
ップ用のplistファイルをプロジェクトに追加し、
次のようなコードを書く。
// TiledMap用のチップ画像の準備
CCSpriteFrameCache *frameCache =
[CCSpriteFrameCache sharedSpriteFrameCache];
[frameCache addSpriteFramesWithFile:@"map_items.plist"];
// TiledMapの表示
CCTMXTiledMap *tiledMap =
[CCTMXTiledMap tiledMapWithTMXFile:@"field_map.tmx"];
[self addChild:tiledMap];
◎cocos2dを使うと実装がラク。
4行で書けます。
©makohira2013
実行結果
©makohira2013
TiledMapの表示位置はpositionプロパティで設定できます。
// TiledMapの表示位置を設定
int x = 84;
int y = 19;
float mapItemSizeX =
(tiledMap.tileSize.width / CC_CONTENT_SCALE_FACTOR()) * tiledMap.scaleX;
float mapItemSizeY =
(tiledMap.tileSize.height / CC_CONTENT_SCALE_FACTOR()) * tiledMap.scaleY;
int itemCountY = tiledMap.mapSize.height;
tiledMap.position =
CGPointMake(-(x * mapItemSizeX), -(itemCountY - y) * mapItemSizeY);
©makohira2013
実行結果
元の位置
©makohira2013
実行結果
元の位置 指定した位置
©makohira2013
makohiraは
今後もスマートフォン向けのアプリ開発
を継続して行っていきたいと思います。
今後ともよろしくお願いします。
ご清聴ありがとうございました。
最後に
©makohira2013

More Related Content

Recently uploaded

Recently uploaded (11)

知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
知識ゼロの営業マンでもできた!超速で初心者を脱する、悪魔的学習ステップ3選.pptx
 
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その22024/04/26の勉強会で発表されたものです。
 
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
論文紹介:Selective Structured State-Spaces for Long-Form Video Understanding
 
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
LoRaWANスマート距離検出センサー  DS20L  カタログ  LiDARデバイスLoRaWANスマート距離検出センサー  DS20L  カタログ  LiDARデバイス
LoRaWANスマート距離検出センサー DS20L カタログ LiDARデバイス
 
Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)
Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)
Observabilityは従来型の監視と何が違うのか(キンドリルジャパン社内勉強会:2022年10月27日発表)
 
Utilizing Ballerina for Cloud Native Integrations
Utilizing Ballerina for Cloud Native IntegrationsUtilizing Ballerina for Cloud Native Integrations
Utilizing Ballerina for Cloud Native Integrations
 
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
Amazon SES を勉強してみる その32024/04/26の勉強会で発表されたものです。
 
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアルLoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
LoRaWAN スマート距離検出デバイスDS20L日本語マニュアル
 
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
論文紹介: The Surprising Effectiveness of PPO in Cooperative Multi-Agent Games
 
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
論文紹介:Video-GroundingDINO: Towards Open-Vocabulary Spatio-Temporal Video Groun...
 
新人研修 後半 2024/04/26の勉強会で発表されたものです。
新人研修 後半        2024/04/26の勉強会で発表されたものです。新人研修 後半        2024/04/26の勉強会で発表されたものです。
新人研修 後半 2024/04/26の勉強会で発表されたものです。
 

Featured

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Cocos2dでRPG(第14回iPhone名古屋勉強会発表資料)