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

PHP-Conference-Odawara-2024-04-000000000
PHP-Conference-Odawara-2024-04-000000000PHP-Conference-Odawara-2024-04-000000000
PHP-Conference-Odawara-2024-04-000000000Shota Ito
 
スマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システムスマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システムsugiuralab
 
新人研修のまとめ 2024/04/12の勉強会で発表されたものです。
新人研修のまとめ       2024/04/12の勉強会で発表されたものです。新人研修のまとめ       2024/04/12の勉強会で発表されたものです。
新人研修のまとめ 2024/04/12の勉強会で発表されたものです。iPride Co., Ltd.
 
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略Ryo Sasaki
 
UPWARD_share_company_information_20240415.pdf
UPWARD_share_company_information_20240415.pdfUPWARD_share_company_information_20240415.pdf
UPWARD_share_company_information_20240415.pdffurutsuka
 
IoT in the era of generative AI, Thanks IoT ALGYAN.pptx
IoT in the era of generative AI, Thanks IoT ALGYAN.pptxIoT in the era of generative AI, Thanks IoT ALGYAN.pptx
IoT in the era of generative AI, Thanks IoT ALGYAN.pptxAtomu Hidaka
 
20240412_HCCJP での Windows Server 2025 Active Directory
20240412_HCCJP での Windows Server 2025 Active Directory20240412_HCCJP での Windows Server 2025 Active Directory
20240412_HCCJP での Windows Server 2025 Active Directoryosamut
 
Postman LT Fukuoka_Quick Prototype_By Daniel
Postman LT Fukuoka_Quick Prototype_By DanielPostman LT Fukuoka_Quick Prototype_By Daniel
Postman LT Fukuoka_Quick Prototype_By Danieldanielhu54
 
Amazon SES を勉強してみる その12024/04/12の勉強会で発表されたものです。
Amazon SES を勉強してみる その12024/04/12の勉強会で発表されたものです。Amazon SES を勉強してみる その12024/04/12の勉強会で発表されたものです。
Amazon SES を勉強してみる その12024/04/12の勉強会で発表されたものです。iPride Co., Ltd.
 

Recently uploaded (9)

PHP-Conference-Odawara-2024-04-000000000
PHP-Conference-Odawara-2024-04-000000000PHP-Conference-Odawara-2024-04-000000000
PHP-Conference-Odawara-2024-04-000000000
 
スマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システムスマートフォンを用いた新生児あやし動作の教示システム
スマートフォンを用いた新生児あやし動作の教示システム
 
新人研修のまとめ 2024/04/12の勉強会で発表されたものです。
新人研修のまとめ       2024/04/12の勉強会で発表されたものです。新人研修のまとめ       2024/04/12の勉強会で発表されたものです。
新人研修のまとめ 2024/04/12の勉強会で発表されたものです。
 
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
[DevOpsDays Tokyo 2024] 〜デジタルとアナログのはざまに〜 スマートビルディング爆速開発を支える 自動化テスト戦略
 
UPWARD_share_company_information_20240415.pdf
UPWARD_share_company_information_20240415.pdfUPWARD_share_company_information_20240415.pdf
UPWARD_share_company_information_20240415.pdf
 
IoT in the era of generative AI, Thanks IoT ALGYAN.pptx
IoT in the era of generative AI, Thanks IoT ALGYAN.pptxIoT in the era of generative AI, Thanks IoT ALGYAN.pptx
IoT in the era of generative AI, Thanks IoT ALGYAN.pptx
 
20240412_HCCJP での Windows Server 2025 Active Directory
20240412_HCCJP での Windows Server 2025 Active Directory20240412_HCCJP での Windows Server 2025 Active Directory
20240412_HCCJP での Windows Server 2025 Active Directory
 
Postman LT Fukuoka_Quick Prototype_By Daniel
Postman LT Fukuoka_Quick Prototype_By DanielPostman LT Fukuoka_Quick Prototype_By Daniel
Postman LT Fukuoka_Quick Prototype_By Daniel
 
Amazon SES を勉強してみる その12024/04/12の勉強会で発表されたものです。
Amazon SES を勉強してみる その12024/04/12の勉強会で発表されたものです。Amazon SES を勉強してみる その12024/04/12の勉強会で発表されたものです。
Amazon SES を勉強してみる その12024/04/12の勉強会で発表されたものです。
 

Featured

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 HubspotMarius Sescu
 
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 ChatGPTExpeed Software
 
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 EngineeringsPixeldarts
 
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 HealthThinkNow
 
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.pdfmarketingartwork
 
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 2024Neil Kimberley
 
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)contently
 
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 2024Albert Qian
 
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 InsightsKurio // The Social Media Age(ncy)
 
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 2024Search Engine Journal
 
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 summarySpeakerHub
 
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 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 Tessa Mero
 
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 IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
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 managementMindGenius
 
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...RachelPearson36
 

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名古屋勉強会発表資料)