Help
RSS
API
Feed
Maltego
Contact
Domain > ha205.rundog.org
×
Welcome!
Right click nodes and scroll the mouse to navigate the graph.
×
More information on this domain is in
AlienVault OTX
Is this malicious?
Yes
No
DNS Resolutions
Date
IP Address
2020-12-12
157.7.107.101
(
ClassC
)
2024-09-14
157.7.107.175
(
ClassC
)
Port 80
HTTP/1.1 200 OKDate: Sat, 14 Sep 2024 13:17:37 GMTContent-Type: text/html; charsetUTF-8Transfer-Encoding: chunkedConnection: keep-aliveServer: ApacheX-Powered-By: PHP/7.4.33Link: https://ha205.rundog.org/index.php?rest_route/>; relhttps://api.w.org/Vary: Range,Accept-EncodingAccept-Ranges: none !DOCTYPE html>html langja>head> meta charsetUTF-8> meta nameviewport contentwidthdevice-width, initial-scale1> link relprofile hrefhttp://gmpg.org/xfn/11> title>https://ha205.rundog.org/ – for trainees of Hirano's class only/title>meta namerobots contentnoindex,nofollow />link reldns-prefetch href//s.w.org />link relalternate typeapplication/rss+xml titlehttps://ha205.rundog.org/ » フィード hrefhttps://ha205.rundog.org />link relalternate typeapplication/rss+xml titlehttps://ha205.rundog.org/ » コメントフィード hrefhttps://ha205.rundog.org/?feedcomments-rss2 /> script typetext/javascript> window._wpemojiSettings {baseUrl:https:\/\/s.w.org\/images\/core\/emoji\/13.0.0\/72x72\/,ext:.png,svgUrl:https:\/\/s.w.org\/images\/core\/emoji\/13.0.0\/svg\/,svgExt:.svg,source:{concatemoji:http:\/\/ha205.rundog.org\/wp-includes\/js\/wp-emoji-release.min.js?ver5.5.15}}; !function(e,a,t){var n,r,o,ia.createElement(canvas),pi.getContext&&i.getContext(2d);function s(e,t){var aString.fromCharCode;p.clearRect(0,0,i.width,i.height),p.fillText(a.apply(this,e),0,0);ei.toDataURL();return p.clearRect(0,0,i.width,i.height),p.fillText(a.apply(this,t),0,0),ei.toDataURL()}function c(e){var ta.createElement(script);t.srce,t.defert.typetext/javascript,a.getElementsByTagName(head)0.appendChild(t)}for(oArray(flag,emoji),t.supports{everything:!0,everythingExceptFlag:!0},r0;ro.length;r++)t.supportsorfunction(e){if(!p||!p.fillText)return!1;switch(p.textBaselinetop,p.font600 32px Arial,e){caseflag:return s(127987,65039,8205,9895,65039,127987,65039,8203,9895,65039)?!1:!s(55356,56826,55356,56819,55356,56826,8203,55356,56819)&&!s(55356,57332,56128,56423,56128,56418,56128,56421,56128,56430,56128,56423,56128,56447,55356,57332,8203,56128,56423,8203,56128,56418,8203,56128,56421,8203,56128,56430,8203,56128,56423,8203,56128,56447);caseemoji:return!s(55357,56424,8205,55356,57212,55357,56424,8203,55356,57212)}return!1}(or),t.supports.everythingt.supports.everything&&t.supportsor,flag!or&&(t.supports.everythingExceptFlagt.supports.everythingExceptFlag&&t.supportsor);t.supports.everythingExceptFlagt.supports.everythingExceptFlag&&!t.supports.flag,t.DOMReady!1,t.readyCallbackfunction(){t.DOMReady!0},t.supports.everything||(nfunction(){t.readyCallback()},a.addEventListener?(a.addEventListener(DOMContentLoaded,n,!1),e.addEventListener(load,n,!1)):(e.attachEvent(onload,n),a.attachEvent(onreadystatechange,function(){completea.readyState&&t.readyCallback()})),(nt.source||{}).concatemoji?c(n.concatemoji):n.wpemoji&&n.twemoji&&(c(n.twemoji),c(n.wpemoji)))}(window,document,window._wpemojiSettings); /script> style typetext/css>img.wp-smiley,img.emoji { display: inline !important; border: none !important; box-shadow: none !important; height: 1em !important; width: 1em !important; margin: 0 .07em !important; vertical-align: -0.1em !important; background: none !important; padding: 0 !important;}/style> link relstylesheet idwp-block-library-css hrefhttp://ha205.rundog.org/wp-includes/css/dist/block-library/style.min.css?ver5.5.15 typetext/css mediaall />link relstylesheet iddnd-upload-cf7-css hrefhttp://ha205.rundog.org/wp-content/plugins/drag-and-drop-multiple-file-upload-contact-form-7/assets/css/dnd-upload-cf7.css?ver1.3.5.9 typetext/css mediaall />link relstylesheet idcontact-form-7-css hrefhttp://ha205.rundog.org/wp-content/plugins/contact-form-7/includes/css/styles.css?ver5.4.1 typetext/css mediaall />link relstylesheet idscaffold-style-css hrefhttp://ha205.rundog.org/wp-content/themes/scaffold/style.css?ver1.3.1 typetext/css mediaall />script typetext/javascript srchttp://ha205.rundog.org/wp-includes/js/jquery/jquery.js?ver1.12.4-wp idjquery-core-js>/script>link relhttps://api.w.org/ hrefhttps://ha205.rundog.org/index.php?rest_route/ />link relEditURI typeapplication/rsd+xml titleRSD hrefhttps://ha205.rundog.org/xmlrpc.php?rsd />link relwlwmanifest typeapplication/wlwmanifest+xml hrefhttp://ha205.rundog.org/wp-includes/wlwmanifest.xml /> meta namegenerator contentWordPress 5.5.15 /> style> .menu-1 { background-color: #ba4a34; } .menu-1 li:hover, .menu-1 li.focus { background-color: #a1311b; } .menu-1 ul ul li { background-color: #881802; } .menu-1 .sub-menu li:hover { background-color: #6f0000; } .menu-toggle { background-color: #ba4a34; } .toggled .menu-toggle { background-color: #881802; } /style> style typetext/css> .site-title a { color: #000000; } .site-header { min-height: 173px; } /style> link relicon hrefhttps://ha205.rundog.org/wp-content/uploads/2020/10/cropped-Rロゴ1-32x32.jpg sizes32x32 />link relicon hrefhttps://ha205.rundog.org/wp-content/uploads/2020/10/cropped-Rロゴ1-192x192.jpg sizes192x192 />link relapple-touch-icon hrefhttps://ha205.rundog.org/wp-content/uploads/2020/10/cropped-Rロゴ1-180x180.jpg />meta namemsapplication-TileImage contenthttps://ha205.rundog.org/wp-content/uploads/2020/10/cropped-Rロゴ1-270x270.jpg />/head>body classhome blog hfeed>div classsite-wrapper> header classsite-header> div classwrapper> div classsite-branding> h1 classsite-title> a hrefhttps://ha205.rundog.org/ relhome> https://ha205.rundog.org/ /a> /h1> p classsite-description> for trainees of Hirano's class only /p> /div>!-- .site-branding --> /div>!-- .wrapper --> /header>!-- .site-header --> nav idsite-navigation classmenu-1> div classwrapper> button classmenu-toggle aria-controlssite-menu aria-expandedfalse> サイトナビゲーション /button> div classmenu-%e3%83%a1%e3%82%a4%e3%83%b3-container>ul idsite-menu classmenu>li idmenu-item-36 classmenu-item menu-item-type-post_type menu-item-object-page menu-item-36>a hrefhttps://ha205.rundog.org/?page_id34>提出フォーム/a>/li>li idmenu-item-520 classmenu-item menu-item-type-custom menu-item-object-custom menu-item-520>a hrefhttps://ha205.rundog.org/wp-content/uploads/2021/04/ha205.pdf>スケジュール/a>/li>li idmenu-item-333 classmenu-item menu-item-type-custom menu-item-object-custom menu-item-333>a hrefhttps://ameblo.jp/maurundog/>講師ブログ/a>/li>li idmenu-item-334 classmenu-item menu-item-type-custom menu-item-object-custom menu-item-334>a hrefhttps://www.youtube.com/channel/UC6VurzFHXlwkOKaTUj352cg/videos>講師のYoutubeチャンネル/a>/li>/ul>/div> /div>!-- .wrapper -->/nav>!-- .menu-1 --> div classsite-content> div classwrapper>div classcontent-area> article classpost-2017 post type-post status-publish format-standard hentry category-5> header classentry-header> h2 classentry-title>a hrefhttps://ha205.rundog.org/?p2017 relbookmark>最終回の講義メモ/a>/h2> div classentry-meta> span classposted-on>投稿日: a hrefhttps://ha205.rundog.org/?p2017 relbookmark>time classentry-date published datetime2021-09-11T13:34:15+09:00>2021年9月11日/time>time classupdated datetime2021-09-11T17:31:02+09:00>2021年9月11日/time>/a>/span>span classbyline> 投稿者: span classauthor vcard>a classurl fn n hrefhttps://ha205.rundog.org/?author1>maurundog/a>/span>/span> /div>!-- .entry-meta --> /header>!-- .entry-header --> div classentry-content> p>講義の進行にご協力をありがとうございましたbr />・このサイトはある限り残しますがいつかは消えます。br />・講義内容についてのお問合せは、終了後も受け付けます。ただし、お返事には時間がかかる場合があります。br />講義メモ:a hrefhttps://ha205.rundog.org/wp-content/uploads/2021/09/講義メモ20210911.zip>講義メモ20210911.zip/a>/p> /div>!-- .entry-content --> footer classentry-footer> span classcat-links>カテゴリー: a hrefhttps://ha205.rundog.org/?cat5 relcategory>講師より/a>/span>span classcomments-link>ディスカッション:a hrefhttps://ha205.rundog.org/?p2017#respond classcomments-link >コメントを残す/a>/span> /footer>!-- .entry-footer -->/article>!-- #post-## -->article classpost-2010 post type-post status-publish format-standard hentry category-5> header classentry-header> h2 classentry-title>a hrefhttps://ha205.rundog.org/?p2010 relbookmark>講義メモ 後半:ゲーム開発演習/a>/h2> div classentry-meta> span classposted-on>投稿日: a hrefhttps://ha205.rundog.org/?p2010 relbookmark>time classentry-date published datetime2021-09-11T12:56:55+09:00>2021年9月11日/time>time classupdated datetime2021-09-11T13:30:35+09:00>2021年9月11日/time>/a>/span>span classbyline> 投稿者: span classauthor vcard>a classurl fn n hrefhttps://ha205.rundog.org/?author1>maurundog/a>/span>/span> /div>!-- .entry-meta --> /header>!-- .entry-header --> div classentry-content> p>演習35 自機の被弾によるゲームオーバー/p>pre>・ゲームオーバーをゲームモード=9で示す・自機と敵弾の衝突判定を行い、被弾していたらゲームオーバーとする・ゲームオーバー画面では自機は炎上状態とする・炎上用の画像の例: img srchttps://rundog.org/si/burn.gif> 60×60・ゲームオーバー画面では敵砲台、敵弾は表示しない(背景のスクロールは行う)/pre>p>作成例/p>pre>//演習35 ゲームオーバーusing System; //EventArgsクラス用using System.Windows.Forms; //Formクラス用using System.Drawing; //Point,Size,Imageクラス用//構造体struct infos { //画面上の物体の情報を持つ構造体 int x, y; //XY座標 Image i; //画像への参照 int sx; //X速度 int sy; //y速度 double sr; //移動角度 bool ex; //有無 public int X { get { return x; } set { x value; } } //プロパティ public int Y { get { return y; } set { y value; } } //〃 public int SX { get { return sx; } set { sx value; } } //〃 public int SY { get { return sy; } set { sy value; } } //〃 public bool EX { get { return ex; } set { ex value; } } //〃 public double SR { get { return sr; } set { sr value; } } //〃 public Image I { get { return i; } set { i value; } } //〃 public int MX { get { return x + i.Width / 2; } } //中心X座標を返す〃 public int MY { get { return y + i.Height / 2; } } //中心Y座標を返す〃 public double IL { get { //内径(幅と高さの小さい方の半分)を返す〃 return (i.Width < i.Height) ? i.Width / 2.0 : i.Height / 2.0; } } public infos(int x, int y, Image i) { //コンストラクタ(自機) this.x x; this.y y; this.i i; sx 0; sy 0; sr 0; this.ex true; } public infos(int x, int y, Image i, bool ex) { //コンストラクタ(自弾、敵弾) this.x x; this.y y; this.i i; sx 0; sy -10; sr 0; this.ex ex; }}//クラス定義class mostsimple : Form { //Formを継承すること System.Runtime.InteropServices.DllImport("user32.dll") private static extern short GetKeyState(int nVirtKey); //外部定義指定 Image back0 Image.FromFile("backb2.bmp"); //背景画像①ファイルを得る Image back1 Image.FromFile("backb2.bmp"); //背景画像②ファイルを得る static Image plin Image.FromFile("player.gif"); //自機画像(通常)ファイルを得る static Image plil Image.FromFile("playerl.gif"); //自機画像(左寄)ファイルを得る static Image plir Image.FromFile("playerr.gif"); //自機画像(右寄)ファイルを得る infos P new infos(300, 395, plin); //自機の情報を生成 const int xspeed 10; //左右移動速度 int yspeed 1; //縦スクロール速度 int backc 0; //背景画像のつなぎ目のY座標 const int pbnum 8; //自弾の最大数 int pbcd 0; //自弾の冷却タイマ const int pbcdn 5; //自弾の冷却タイマ数 infos PBA new infospbnum; //自弾の配列 static Image ecnin Image.FromFile("enemy.gif"); //敵砲台画像ファイルを得る const int ecnum 4; //敵砲台数 infos ECA new infosecnum; //敵砲台の配列 int eccd new intecnum; //敵砲台の冷却タイマ const int eccdn 15; //敵砲台の冷却タイマ数 const int ebnum 8; //敵弾の最大数 infos EBA new infosebnum; //敵弾の配列 int gamemode 0; //ゲームモード(開始時:0,ゲーム中:1,ゲームオーバー:9)font colorblue> static Image plib Image.FromFile("burn.gif"); //【追加】自機炎上画像ファイルを得る/font> //共通部品(衝突判定用) private bool isHit(infos a, infos b) { //中心距離を用いた衝突判定 return Math.Pow(a.MX - b.MX, 2) + Math.Pow(a.MY - b.MY, 2) < Math.Pow(a.IL + b.IL, 2); } //共通部品(オブジェクトを指定方向へ45度単位で回転させる) private Point getPoints(infos i, int x, int y) { //オブジェクトiを座標(x,y)方向へ回転するための座標配列を返す int x0, y0, x1, y1, x2, y2; //左上、右上、左下の座標 x0 x1 x2 i.X; //仮にオブジェクトiの左上座標としておく y0 y1 y2 i.Y; //〃 double r Math.Atan2(y - i.MY, x - i.MX); //座標xyとの中心座標角度(ラジアン)を得る double d (Math.Sqrt(2.0) - 1.0) / 2.0; //斜めにした場合にはみ出す部分の割合 if (r > -Math.PI * 7 / 8 && r < -Math.PI * 5 / 8) { //左上 x0 - (int)(i.I.Width * d); y0 + i.I.Height / 2; x1 + i.I.Width / 2; y1 - (int)(i.I.Height * d); x2 x1; y2 + (int)(i.I.Height * (1 + d)); } else if (r > -Math.PI * 5 / 8 && r < -Math.PI * 3 / 8) { //上 x1 + i.I.Width; y2 + i.I.Height; } else if (r > -Math.PI * 3 / 8 && r < -Math.PI * 1 / 8) { //右上 x0 + i.I.Width / 2; y0 - (int)(i.I.Height * 0.2); x1 + (int)(i.I.Width * (1 + d)); y1 + i.I.Height / 2; x2 - (int)(i.I.Width * d); y2 y1; } else if (r > -Math.PI * 1 / 8 && r < Math.PI * 1 / 8) { //右 x0 + i.I.Width; x1 x0; y1 + i.I.Height; } else if (r > Math.PI * 1 / 8 && r < Math.PI * 3 / 8) { //右下 x0 + (int)(i.I.Width * (1 + d)); y0 + i.I.Height / 2; x1 + i.I.Width / 2; y1 + (int)(i.I.Height * (1 + d)); x2 x1; y2 - (int)(i.I.Height * d); } else if (r > Math.PI * 3 / 8 && r < Math.PI * 5 / 8) { //下 x0 + i.I.Width; y0 + i.I.Height; y1 y0; x2 x0; } else if (r > Math.PI * 5 / 8 && r < Math.PI * 7 / 8) { //左下 x0 + i.I.Width / 2; y0 + (int)(i.I.Height * 1.2); x1 - (int)(i.I.Width * d); y1 + i.I.Height / 2; x2 + (int)(i.I.Width * (1 + d)); y2 y1; } else { //左 y0 + i.I.Height; x2 + i.I.Width; y2 y0; } Point pts {new Point(x0, y0), new Point(x1, y1), new Point(x2, y2)}; return pts; } //描画処理(主処理などからシステム経由で呼び出される) protected override void OnPaint(PaintEventArgs e) { //描画処理のオーバーライド base.OnPaint(e); //冒頭で基本クラスのメソッド内容を実行 if (backc ! 0) e.Graphics.DrawImage(back0, 0, backc - back0.Height); //背景画像①を描画 if (backc ! back1.Height) e.Graphics.DrawImage(back1, 0, backc); //背景画像②を描画 if (gamemode 0) { //ゲームモードが開始? SolidBrush sb new SolidBrush(Color.Cyan); //テキストの塗りつぶし指定を生成 Font f new Font("メイリオ", 40, FontStyle.Bold); //フォント指定を生成 e.Graphics.DrawString("Zaviel", f, sb, 210, 190); //ゲーム名を描画 sb new SolidBrush(Color.Yellow); //テキストの塗りつぶし指定を生成 f new Font("メイリオ", 20, FontStyle.Bold); //フォント指定を生成 e.Graphics.DrawString("Hit Enter to Start !", f, sb, 180, 320); //メッセージを描画font colorblue> } else if (gamemode 1) { //【変更】プレイ中?/font> for (int i 0; i < pbnum; i++) { //全自弾分繰返す if (PBAi.EX) e.Graphics.DrawImage(PBAi.I, PBAi.X, PBAi.Y); //自弾画像を描画 } for (int i 0; i < ebnum; i++) { //全敵弾分繰返す if (EBAi.EX) e.Graphics.DrawImage(EBAi.I, EBAi.X, EBAi.Y); //敵弾画像を描画 } for (int i 0; i < ecnum; i++) { //全敵砲台分繰返す if (ECAi.EX) e.Graphics.DrawImage(ECAi.I, getPoints(ECAi, P.MX, P.MY)); //自機に向くように描画 } e.Graphics.DrawImage(P.I, P.X, P.Y); //自機画像を描画font colorblue> } else { //【以下追加】ゲームオーバー? e.Graphics.DrawImage(plib, P.X, P.Y); //自機炎上画像を描画 SolidBrush sb new SolidBrush(Color.Orange); //テキストの塗りつぶし指定を生成 Font f new Font("メイリオ", 40, FontStyle.Bold); //フォント指定を生成 e.Graphics.DrawString("Game Over", f, sb, 155, 190); //ゲームオーバーを描画 }/font> } //主処理(タイマーに呼び出される) private void play(object o, EventArgs ea){ //キー入力 if (GetKeyState((int)Keys.Escape) < 0) { //Escキーが押されている this.Close(); //終了 } if (gamemode 0) { //ゲームモードが開始? if (GetKeyState((int)Keys.Enter) < 0) { //Enterキーが押されている gamemode 1; //ゲームモードをゲーム中に }font colorblue> } else if (gamemode 1) { //【変更】プレイ中?/font> P.I plin; //自機画像(通常)を用いる if (GetKeyState((int)Keys.Left) < 0) { //←キーが押されている P.I plil; //自機画像(左寄)を用いる if(P.SX > -xspeed) P.SX - 2; //左移動の速度を設定 } else if (GetKeyState((int)Keys.Right) < 0) { //→キーが押されている P.I plir; //自機画像(右寄)を用いる if(P.SX < xspeed) P.SX + 2; //右移動の速度を設定 } if (GetKeyState((int)Keys.Up) < 0) { //↑キーが押されている if(P.SY > -yspeed) P.SY - 5; //上移動の速度を設定 } else if (GetKeyState((int)Keys.Down) < 0) { //↓キーが押されている if(P.SY < yspeed) P.SY + 5; //下移動の速度を設定 } if (GetKeyState((int)Keys.Space) < 0) { //スペースキーが押されている if (pbcd < 0) { //冷却完了? int i 0; //発射可能な自弾の添字 for (; i < pbnum; i++) { //全自弾分繰返す if(!PBAi.EX) break; //自弾iが発射可能なら繰返し終了 } if (i < pbnum) { //発射可能な自弾があれば PBAi.X P.X + P.I.Width / 2 - PBAi.I.Width / 2; //X座標は自機の中央 PBAi.Y P.Y - PBAi.I.Height; //Y座標は自機の直上 PBAi.EX true; //自弾i有 } pbcd pbcdn; //冷却タイマをセット } else { //冷却中? pbcd--; //冷却タイマカウントダウン } } //自機の移動 if (P.SX < 0) { //左へ移動中? P.X + P.SX; //左へ移動 if (P.X < 0) { //左端を超えたら P.X 0; //左端に固定 P.SX 0; //移動停止 } else { P.SX++; //減速 } } else if (P.SX > 0) { //右へ移動中? P.X + P.SX; //右へ移動 if (P.X > back0.Width - P.I.Width) { //右端を超えたら P.X back0.Width - P.I.Width; //右端に固定 P.SX 0; //移動停止 } else { P.SX--; //減速 } } if (P.SY < 0) { //上へ移動中? P.Y + P.SY; //上へ移動 if (P.Y < 0) { //上端を超えたら P.Y 0; //上端に固定 P.SY 0; //移動停止 } else { P.SY++; //減速 } } else if (P.SY > 0) { //下へ移動中? P.Y + P.SY; //下へ移動 if (P.Y > back0.Height - P.I.Height) { //下端を超えたら P.Y back0.Height - P.I.Height; //下端に固定 P.SY 0; //移動停止 } else { P.SY--; //減速 } } //自弾の移動と衝突判定 for (int i 0; i < pbnum; i++) { //全自弾分繰返す if (PBAi.EX) { //自弾iがあれば PBAi.Y + PBAi.SY; //上へ移動 if (PBAi.Y < -PBAi.I.Height) { //上端を超えたら PBAi.EX false; //自弾iを消す } else { for (int j 0; j < ecnum; j++) { //全敵砲台分繰返す if (ECAj.EX && isHit(PBAi, ECAj)) { //自弾iと敵砲台jが衝突? PBAi.EX false; //自弾iを消す ECAj.EX false; //敵砲台jを消す } } } } } //敵弾の移動と衝突判定 for (int i 0; i < ebnum; i++) { //全敵弾分繰返す if (EBAi.EX){ //敵弾があれば EBAi.X EBAi.X + (int)(Math.Cos(EBAi.SR) * 10); //角度から移動先X座標を得る EBAi.Y EBAi.Y + (int)(Math.Sin(EBAi.SR) * 10); //角度から移動先Y座標を得るfont colorblue> if (EBAi.MX < 0 || EBAi.MX > 640 || EBAi.MY < 0 || EBAi.MY > 480) { //【変更】/font> EBAi.EX false; //出たら消すfont colorblue> } else if (isHit(EBAi, P)) { //【以下追加】敵弾iと自機が衝突? gamemode 9; //ゲームオーバーにする }/font> } } //敵砲台の移動と敵弾の出現 for (int i 0; i < ecnum; i++) { //全敵砲台分繰返す if (ECAi.EX && ECAi.MY > 0 && ECAi.MY < 400) { //敵砲台iが範囲内に出現中? if (eccdi < 0) { //冷却完了? int j 0; //発射可能な敵弾の添字 for (; j < ebnum; j++) { //全敵弾分繰返す if(!EBAj.EX) break; //敵弾jが発射可能なら繰返し終了 } if (j < ebnum) { //発射可能な敵弾があれば EBAj.X ECAi.MX - EBAj.I.Width / 2; //敵砲台iの中央 EBAj.Y ECAi.MY - EBAj.I.Height / 2; //〃 EBAj.SR Math.Atan2(P.MY - EBAj.MY, P.MX - EBAj.MX); //座標xyとの中心座標角度(ラジアン)を得る EBAj.EX true; //敵弾出現 } eccdi eccdn; //冷却タイマをセット } else { //冷却中? eccdi--; //冷却タイマカウントダウン } } if (ECAi.Y < back0.Height * 2 - ecnin.Height) { //敵砲台が下端に達するまで ECAi.Y + yspeed; //下方に移動 } else { //下端に達したら ECAi.Y -ecnin.Height; //上方から出現 ECAi.EX true; //敵砲台iを再出現 } } } //背景の移動 backc (backc < back0.Height) ? backc + yspeed : 0; //背景画像のつなぎ目を下げる Invalidate(); //画面に反映 } //コンストラクタ mostsimple() { SetStyle(ControlStyles.DoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true); //ダブルバッファリングを設定 for (int i 0; i < pbnum; i++) { //全自弾分繰返す PBAi new infos(0, 0, Image.FromFile("bullet.gif"), false); //自弾の情報を生成 } ECA0 new infos(115, 440, Image.FromFile("enemy.gif"), true); //敵砲台生成(仮) ECA1 new infos(462, 440, ECA0.I, true); //〃 ECA2 new infos(115, 920, ECA0.I, true); //〃 ECA3 new infos(462, 920, ECA0.I, true); //〃 for (int i 0; i < ebnum; i++) { //全敵弾分繰返す EBAi new infos(0, 0, Image.FromFile("ebullet.gif"), false); //敵弾の情報を生成 } Timer t new Timer(); //タイマーオブジェクトの生成 t.Tick + new EventHandler(play); //タイマにメソッドを指定する t.Interval 20; //タイマ間隔を指定 t.Start(); //タイマを起動 } //起動処理 static void Main() { mostsimple ms new mostsimple(); //自オブジェクトを生成 ms.StartPosition FormStartPosition.Manual; //表示位置の調整を可能にする ms.Location new Point(0, 0); //フォーム左上端の位置を指定 ms.Size new Size(660, 520); //幅(640->660)と高さ(480->520)を指定 ms.Text "Game"; //タイトルを設定 ms.ControlBox false; ms.FormBorderStyle FormBorderStyle.Fixed3D; Application.Run(ms); //自オブジェクトへの参照をRunに与えることで開く }}/pre>p>補足:サウンド/p>pre>・C#のサウンド処理手法は複数提供されており、用途や特性に使い分けると良い・もっとも単純なのがSystem.Media.SoundPlayerを利用する手法・音声ファイルの読み込み System.Media.SoundPlayer 参照変数 new System.Media.SoundPlayer(ファイル名);・音声ファイルの再生(一回) 参照変数.Play();・音声ファイルのくり返し再生 参照変数.PlayLooping();・音声ファイルの再生の終了 参照変数.Stop();※ BGMと効果音の音声ファイルは下記を利用可能 https://rundog.org/si/briefing.wav 開始BGM https://rundog.org/si/stageA.wav プレイBGM https://rundog.org/si/Extra.wav ゲームオーバーBGM https://rundog.org/si/missile.wav 効果音/pre>p>参考:今回使用した素材について/p>pre>・ガルル研ライブラリが公開したフリー素材を用いています http://www.garuru.co.jp/top/lib/index.php/pre>p>以上です。/p> /div>!-- .entry-content --> footer classentry-footer> span classcat-links>カテゴリー: a hrefhttps://ha205.rundog.org/?cat5 relcategory>講師より/a>/span>span classcomments-link>ディスカッション:a hrefhttps://ha205.rundog.org/?p2010#respond classcomments-link >コメントを残す/a>/span> /footer>!-- .entry-footer -->/article>!-- #post-## -->article classpost-1989 post type-post status-publish format-standard hentry category-5> header classentry-header> h2 classentry-title>a hrefhttps://ha205.rundog.org/?p1989 relbookmark>講義メモ/a>/h2> div classentry-meta> span classposted-on>投稿日: a hrefhttps://ha205.rundog.org/?p1989 relbookmark>time classentry-date published datetime2021-09-11T11:04:17+09:00>2021年9月11日/time>time classupdated datetime2021-09-11T12:51:29+09:00>2021年9月11日/time>/a>/span>span classbyline> 投稿者: span classauthor vcard>a classurl fn n hrefhttps://ha205.rundog.org/?author1>maurundog/a>/span>/span> /div>!-- .entry-meta --> /header>!-- .entry-header --> div classentry-content> p>前半:p.409「データの並べ替えと個数」からbr />後半:ゲーム開発演習:自機の被弾によるゲームオーバーなど/p>p>p.409 データの並べ替えと個数/p>pre>・SQLの強みとして整列(ソート)のしやすさやグルーピングなどがある・昇順整列については、Linqで「orderby 項目名」でそのまま実装されている・降順整列にするには「orderby 項目名 descending」とすれば良い・また、クエリ結果に含まれるデータ件数を返すメソッドとして、Count()が提供されている/pre>p>p.409 linq02.cs 解説/p>pre>// p.409 linq02.cs 解説using System;using System.Collections.Generic; //IEnumerable<T>用using System.Linq; //内部的にIQueryable<T>用class linq02 { public static void Main() { string myStr {"flower", "cat", "dog", "bird", "rabbit"}; // クエリの作成(4文字以上を抽出し降順にソート) IEnumerable<string> q from s in myStr where s.Length > 4font colorblue> orderby s descending/font> select s; // クエリの実行 foreach (string x in q) Console.WriteLine(x); // 検索条件に適合した要素の個数font colorblue> Console.WriteLine("適合した数{0}", q.Count());/font> }}/pre>p>p.410 var型の利用/p>pre>・Linqのクエリ結果のオブジェクトの型は暗黙の型指定を用いると良い/pre>p>p.410 Listコレクションからのデータ抽出/p>pre>・配列と同様に、Listコレクション(p.367)のクエリをLinqで記述できる/pre>p>p.411 linq03.cs 解説/p>pre>// p.411 linq03.cs 解説using System;using System.Collections.Generic; //IEnumerable<T>、List<T>用using System.Linq; //内部的にIQueryable<T>用class data { public string name; public string address; public int age;}class linq03 { public static void Main() { List<data> mydata new List<data> { //オブジェクト初期化子を利用 new data {name "田中和夫", address "東京都", age 24}, new data {name "鈴木義男", address "東京都", age 17}, new data {name "吉田育子", address "青森県", age 24}, new data {name "田中和夫", address "東京都", age 34}, new data {name "小林一郎", address "北海道", age 29} }; // 旧式のデータ追加 data datax new data(); datax.name "粂井康孝"; datax.address "北海道"; datax.age 22; mydata.Add(datax); // 新方式のデータ追加(オブジェクト初期化子を利用) mydata.Add( new data {name "猫山太郎", address "青森県", age 15} );font colorblue> var q from x in mydata where x.age < 30 orderby x.age ascending select x; //Listに対するクエリ(暗黙の型指定を利用)/font> Console.WriteLine("氏名\t\t住所\t年齢"); foreach (data z in q) Console.WriteLine("{0}\t{1}\t{2}", z.name, z.address, z.age); }}/pre>p>p.413 メソッド構文の利用/p>pre>・Linqのクエリの構文として、よりC#らしい記述になるのがメソッド構文・where、orderby、selectを、メソッド風にWhere()、OrderBy()、Select()と記述できる・「orderby ● descending」は、メソッド風にOrderByDescending()と記述できる・それぞれのカッコ内(見かけ上の引数)には、詳細を記述したメソッドの名前を記述する・「using System.Collections.Generic;」は不要になる(using System.Linq;は必要)/pre>p>p.413 linq04.cs 解説/p>pre>// p.413 linq04.cs 解説using System;using System.Linq;class linq04 {font colorblue> static bool MyWhere(int x) { return (x > 0); } //Where用の条件式 static int MyOrderBy(int x) { return x; } //OrderBy用の何もしない式 static int MySelect(int x) { return x; } //Select用の何もしない式/font> public static void Main() { int numbers new int { 200, -3, 4, 1, 2, -6, 3, 100, -25 };font colorblue> //メソッド構文(条件で抽出した結果を降順に整列) var q numbers.Where(MyWhere) .OrderByDescending(MyOrderBy) .Select(MySelect);/font> //クエリの実行 foreach (int x in q) Console.WriteLine(x); }}/pre>p>p.415 メソッド構文の利用(匿名メソッド)/p>pre>・メソッド構文は冗長になるので、匿名メソッド(p.304)とすると良い・すると、メソッドの定義を排してdelegateでLinqの中に記述できる例:var q x.Where(delegate(int x){return x > 0;}).Select(delegate(int x){return x;});/pre>p>p.415 linq05.cs 解説/p>pre>// p.415 linq05.cs 解説using System;using System.Linq; //内部的にLinq用class linq05 { public static void Main() { int numbers new int {200, -3, 4, 1, 2, -6, 3, 100, -25};font colorblue> //メソッド構文(匿名メソッド) var q numbers.Where(delegate(int x) { return x > 0; }) .OrderByDescending(delegate (int x) { return x; }) .Select(delegate (int x) { return x; });/font> //クエリの実行 foreach (int x in q) Console.WriteLine(x); }}/pre>p>p.415 メソッド構文の利用(ラムダ式)/p>pre>・匿名メソッドを用いたメソッド構文は、ラムダ式にするとより見やすい 例:var q x.Where(x > x > 0).Select(x > x);/pre>p>p.415 linq06.cs 解説/p>pre>// p.415 linq06.cs 解説using System;using System.Linq; //内部的にLinq用class linq06 { public static void Main() { int numbers new int {200, -3, 4, 1, 2, -6, 3, 100, -25};font colorblue> //メソッド構文(ラムダ式) var q numbers.Where(x > x > 0) .OrderByDescending(x > x) .Select(x > x);/font> //クエリの実行 foreach (int x in q) Console.WriteLine(x); }}/pre>p>演習17-1 メソッド構文の利用(ラムダ式)/p>pre>・p.411 linq03.csをメソッド構文(ラムダ式)を用いて改良しよう/pre>p>作成例/p>pre>//演習17-1 メソッド構文の利用(ラムダ式)using System;using System.Collections.Generic; //IEnumerable<T>、List<T>用using System.Linq; //内部的にIQueryable<T>用class data { public string name; public string address; public int age;}class linq03 { public static void Main() { List<data> mydata new List<data> { //オブジェクト初期化子を利用 new data {name "田中和夫", address "東京都", age 24}, new data {name "鈴木義男", address "東京都", age 17}, new data {name "吉田育子", address "青森県", age 24}, new data {name "田中和夫", address "東京都", age 34}, new data {name "小林一郎", address "北海道", age 29} };font colorblue> var q mydata.Where(x > x.age < 30) .OrderBy(x > x.age) .Select(x > x); //Listに対するクエリ(ラムダ式を利用)/font> Console.WriteLine("氏名\t\t住所\t年齢"); foreach (data z in q) Console.WriteLine("{0}\t{1}\t{2}", z.name, z.address, z.age); }}/pre>p>p.416 XMLデータとLINQ/p>pre>・XDocumentクラスまたはXElementクラスを利用すると、XMLファイルからデータソースを得られる・利用には、using System.Xml.Linq を指定すると良い・XElementクラスの静的メソッドLoad(XMLファイル名)で、XElementクラス型のオブジェクトが得られる・これをLinqの対象としてクエリを行うことができる・Element(項目名)メソッドで要素への参照を得て、Valueプロパティでその値を得る ※ Valueで得た値は必要に応じてParseすること・上記は、foreachによる値の読み出しにおいても行う必要がある/pre>p>p.416 XMLデータとLINQ/p>pre>・XDocumentクラスまたはXElementクラスを利用すると、XMLファイルからデータソースを得られる・利用には、using System.Xml.Linq を指定すると良い・XElementクラスの静的メソッドLoad(XMLファイル名)で、XElementクラス型のオブジェクトが得られる・これをLinqの対象としてクエリを行うことができる・Elements()メソッドで全要素への参照を得て、fromのinに用いる・Element(項目名)メソッドで要素への参照を得て、Valueプロパティでその値を得る ※ Valueで得た値は必要に応じてParseすること・上記は、foreachによる値の読み出しにおいても行う必要がある例:XElement xo XElement.Load("XMLファイル名");var q from x in xo.Elements() where x.Element("項目名") ! null select x;foreach (var w in q) Console.Write(w.Element("項目名").Value);・System.Xml.LinqをVisual Studio 2019で用いるには: ①プロジェクトの「参照」を右クリックし「参照の追加」 ②「アセンブリ」の「System.Xml」と「System.Xml.Linq」をダブルクリックし「OK」 ③プロジェクトの「参照」を開いて②が追加されていれば良い/pre>p>p.416 student.xml/p>pre>・ソリューションに「追加」「新しい項目」で「XMLファイル」を選択し、名前を「student.xml」として「追加」・下記を流し込んで「保存」<?xml version"1.0" encoding"utf-8" ?><data> <student> <name>山田太郎</name> <id>100</id> <point>56</point> </student> <student> <name>上野義男</name> <id>101</id> <point>80</point> </student> <student> <name>岡田一郎</name> <id>102</id> <point>70</point> </student> <student> <name>吉田和夫</name> <id>103</id> <point>95</point> </student></data>/pre>p>【正誤】p.417 xml01.cs 016行目/p>pre> 【誤】orderby person.Element(point).Value descending 【正】orderby int.Parse(person.Element(point).Value) descending/pre>p>p.417 xml01.cs 解説/p>pre>// p.417 xml01.cs 解説using System;using System.Linq; //内部的にLinq用using System.Xml.Linq; //XElement用class xml01 { public static void Main() {font colorblue> //XMLファイルを読み込んでXElementクラス型のオブジェクトを得る XElement students XElement.Load("student.xml"); var q //XElementオブジェクトに対するクエリ from person in students.Elements() where int.Parse(person.Element("point").Value) > 60 orderby int.Parse(person.Element("point").Value) descending select person; foreach (var p in q) { //クエリ結果から要素ごとに値を得て表示 Console.WriteLine("{0}, {1}, {2}", p.Element("name").Value, p.Element("point").Value, p.Element("id").Value); }/font> }}/pre>p>p.419 XMLデータとLINQ(ラムダ式)/p>pre>・この場合も、ラムダ式を用いると見やすくなる/pre>p>p.419 xml02.cs 解説/p>pre>// p.419 xml02.cs 解説using System;using System.Linq; //内部的にLinq用using System.Xml.Linq; //XElement用class xml02 { public static void Main() { //XMLファイルを読み込んでXElementクラス型のオブジェクトを得る XElement Students XElement.Load("student.xml");font colorblue> var q //XElementオブジェクトに対するクエリ(ラムダ式) Students.Elements() .Where( x > int.Parse(x.Element("point").Value) > 60) .OrderByDescending( x > int.Parse(x.Element("point").Value)) .Select(x > x);/font> foreach (var p in q) { //クエリ結果から要素ごとに値を得て表示 Console.WriteLine("{0}, {1}, {2}", p.Element("name").Value, p.Element("point").Value, p.Element("id").Value); } }}/pre>p>テキストは以上です。/p> /div>!-- .entry-content --> footer classentry-footer> span classcat-links>カテゴリー: a hrefhttps://ha205.rundog.org/?cat5 relcategory>講師より/a>/span>span classcomments-link>ディスカッション:a hrefhttps://ha205.rundog.org/?p1989#respond classcomments-link >コメントを残す/a>/span> /footer>!-- .entry-footer -->/article>!-- #post-## -->article classpost-1976 post type-post status-publish format-standard hentry category-5> header classentry-header> h2 classentry-title>a hrefhttps://ha205.rundog.org/?p1976 relbookmark>今週の話題/a>/h2> div classentry-meta> span classposted-on>投稿日: a hrefhttps://ha205.rundog.org/?p1976 relbookmark>time classentry-date published datetime2021-09-11T10:34:31+09:00>2021年9月11日/time>time classupdated datetime2021-09-11T10:58:31+09:00>2021年9月11日/time>/a>/span>span classbyline> 投稿者: span classauthor vcard>a classurl fn n hrefhttps://ha205.rundog.org/?author1>maurundog/a>/span>/span> /div>!-- .entry-meta --> /header>!-- .entry-header --> div classentry-content> p>販売本数ランキング 今週首位はまさかの「リングフィット アドベンチャー」a hrefhttps://rundog.org/bbs/link.cgi?rhttps://www.famitsu.com/ranking/game-sales/ targettop relnoopener noreferrer>GO!/a>br />「Slack」がゲーム業界の新たなスタンダードツールに―多くの企業がSlackを導入する理由とメリットとは? a hrefhttps://rundog.org/bbs/link.cgi?rhttps://www.gamebusiness.jp/article/2021/09/08/19037.html targettop relnoopener noreferrer>GO!/a>br />Steam Deckは発売時から全てのゲームをサポートできるわけではない―ただしタイトルは増加する見込み a hrefhttps://rundog.org/bbs/link.cgi?rhttps://www.gamebusiness.jp/article/2021/09/09/19042.html targettop relnoopener noreferrer>GO!/a>br />SIEが『The Persistence』のFiresprite社を買収へ―独占タイトルを強化 a hrefhttps://rundog.org/bbs/link.cgi?rhttps://www.gamebusiness.jp/article/2021/09/09/19041.html targettop relnoopener noreferrer>GO!/a>br />PS4版『Horizon Forbidden West』PS5版への無料アップグレード提供へ―SIEタイトル今後の方針も明らかに a hrefhttps://rundog.org/bbs/link.cgi?rhttps://www.gamebusiness.jp/article/2021/09/06/19028.html targettop relnoopener noreferrer>GO!/a>/p>p>DMCA申請で削除された大型Mod「GTA: Underground」開発中止を発表―Modコミュニティに対する敵意が高まりつつあるため a hrefhttps://rundog.org/bbs/link.cgi?rhttps://www.gamebusiness.jp/article/2021/09/08/19039.html targettop relnoopener noreferrer>GO!/a>br />中国が「未成年者に対するネットゲーム規制」で業界の取締強化との報道―テンセントなど中国ゲーム企業の株は下落傾向 a hrefhttps://rundog.org/bbs/link.cgi?rhttps://www.gamebusiness.jp/article/2021/09/10/19045.html targettop relnoopener noreferrer>GO!/a>br />リメイク版『月姫』動画・生放送は“ネタバレ防止期間後も”公開禁止!9月9日以降はSNSにも注意 a hrefhttps://rundog.org/bbs/link.cgi?rhttps://www.gamebusiness.jp/article/2021/09/07/19031.html targettop relnoopener noreferrer>GO!/a>br />クラウド型の住基システムで一時障害 142市町村で住民票発行できず 現在は復旧 a hrefhttps://rundog.org/bbs/link.cgi?rhttps://www.itmedia.co.jp/news/articles/2109/09/news166.html targettop relnoopener noreferrer>GO!/a>/p> /div>!-- .entry-content --> footer classentry-footer> span classcat-links>カテゴリー: a hrefhttps://ha205.rundog.org/?cat5 relcategory>講師より/a>/span>span classcomments-link>ディスカッション:a hrefhttps://ha205.rundog.org/?p1976#respond classcomments-link >コメントを残す/a>/span> /footer>!-- .entry-footer -->/article>!-- #post-## -->article classpost-1974 post type-post status-publish format-standard hentry category-5> header classentry-header> h2 classentry-title>a hrefhttps://ha205.rundog.org/?p1974 relbookmark>前回のコメントです/a>/h2> div classentry-meta> span classposted-on>投稿日: a hrefhttps://ha205.rundog.org/?p1974 relbookmark>time classentry-date published datetime2021-09-11T09:40:59+09:00>2021年9月11日/time>time classupdated datetime2021-09-11T09:41:25+09:00>2021年9月11日/time>/a>/span>span classbyline> 投稿者: span classauthor vcard>a classurl fn n hrefhttps://ha205.rundog.org/?author1>maurundog/a>/span>/span> /div>!-- .entry-meta --> /header>!-- .entry-header --> div classentry-content> p>・自作の属性を作成してみました。br /> プロジェクト名:20210904CharpProjectbr /> ファイル名:MyTestAttribute.csbr /> 自作の属性の利用する場面など思いつかなかったので今後いろいろ試行錯誤してみてbr /> 自作の属性を活用できるようにしていきたいと思います。/p>p> font colordarkred>拝見しました。いいですね。br /> 下記のC#オフィシャルドキュメントによると、AttributeUsage の指定が推奨?されているようですので、br /> 実務では記述が求められるかもしれません。br /> https://docs.microsoft.com/ja-jp/dotnet/standard/attributes/writing-custom-attributesbr /> あと、Linqのクエリが混じってましたので、何か関連があるのかと思いましたが、とくにつながってないのですね?/font>/p> /div>!-- .entry-content --> footer classentry-footer> span classcat-links>カテゴリー: a hrefhttps://ha205.rundog.org/?cat5 relcategory>講師より/a>/span>span classcomments-link>ディスカッション:a hrefhttps://ha205.rundog.org/?p1974#respond classcomments-link >コメントを残す/a>/span> /footer>!-- .entry-footer -->/article>!-- #post-## -->article classpost-1969 post type-post status-publish format-standard hentry category-5> header classentry-header> h2 classentry-title>a hrefhttps://ha205.rundog.org/?p1969 relbookmark>次回予告と今回の講義メモ/a>/h2> div classentry-meta> span classposted-on>投稿日: a hrefhttps://ha205.rundog.org/?p1969 relbookmark>time classentry-date published updated datetime2021-09-04T13:35:46+09:00>2021年9月4日/time>/a>/span>span classbyline> 投稿者: span classauthor vcard>a classurl fn n hrefhttps://ha205.rundog.org/?author1>maurundog/a>/span>/span> /div>!-- .entry-meta --> /header>!-- .entry-header --> div classentry-content> p>次回、最終回br />前半:p.409「データの並べ替えと個数」からbr />後半:ゲーム開発演習:自機の被弾によるゲームオーバーなどbr />講義メモ:a hrefhttps://ha205.rundog.org/wp-content/uploads/2021/09/講義メモ20210904.zip>講義メモ20210904.zip/a>/p> /div>!-- .entry-content --> footer classentry-footer> span classcat-links>カテゴリー: a hrefhttps://ha205.rundog.org/?cat5 relcategory>講師より/a>/span>span classcomments-link>ディスカッション:a hrefhttps://ha205.rundog.org/?p1969#respond classcomments-link >コメントを残す/a>/span> /footer>!-- .entry-footer -->/article>!-- #post-## -->article classpost-1956 post type-post status-publish format-standard hentry category-5> header classentry-header> h2 classentry-title>a hrefhttps://ha205.rundog.org/?p1956 relbookmark>講義メモ 後半:ゲーム開発演習/a>/h2> div classentry-meta> span classposted-on>投稿日: a hrefhttps://ha205.rundog.org/?p1956 relbookmark>time classentry-date published datetime2021-09-04T12:46:31+09:00>2021年9月4日/time>time classupdated datetime2021-09-04T13:33:38+09:00>2021年9月4日/time>/a>/span>span classbyline> 投稿者: span classauthor vcard>a classurl fn n hrefhttps://ha205.rundog.org/?author1>maurundog/a>/span>/span> /div>!-- .entry-meta --> /header>!-- .entry-header --> div classentry-content> p>全砲台から発射、開始画面(フォント文字列の表示)、ゲームモード/p>p>演習33 敵弾の全砲台からの発射/p>pre>・敵弾がすべての砲台から発射され、自機に向かって移動するようにしよう・敵弾数を8とする・敵砲台ごとに冷却タイマ(発射時に10)を設定し、タイマによってデクリメントする・砲台が画面範囲(中心がY0から400まで)にある時に、冷却タイマが0であれば、 未出現の敵弾を探し、あれば、砲台の中心位置を初期座標として出現させる/pre>p>作成例/p>pre>//演習33 敵弾の複数発射using System; //EventArgsクラス用using System.Windows.Forms; //Formクラス用using System.Drawing; //Point,Size,Imageクラス用//構造体struct infos { //画面上の物体の情報を持つ構造体 int x, y; //XY座標 Image i; //画像への参照 int sx; //X速度 int sy; //y速度 double sr; //移動角度 bool ex; //有無 public int X { get { return x; } set { x value; } } //プロパティ public int Y { get { return y; } set { y value; } } //〃 public int SX { get { return sx; } set { sx value; } } //〃 public int SY { get { return sy; } set { sy value; } } //〃 public bool EX { get { return ex; } set { ex value; } } //〃 public double SR { get { return sr; } set { sr value; } } //〃 public Image I { get { return i; } set { i value; } } //〃 public int MX { get { return x + i.Width / 2; } } //中心X座標を返す〃 public int MY { get { return y + i.Height / 2; } } //中心Y座標を返す〃 public double IL { get { //内径(幅と高さの小さい方の半分)を返す〃 return (i.Width < i.Height) ? i.Width / 2.0 : i.Height / 2.0; } } public infos(int x, int y, Image i) { //コンストラクタ(自機) this.x x; this.y y; this.i i; sx 0; sy 0; sr 0; this.ex true; } public infos(int x, int y, Image i, bool ex) { //コンストラクタ(自弾、敵弾) this.x x; this.y y; this.i i; sx 0; sy -10; sr 0; this.ex ex; }}//クラス定義class mostsimple : Form { //Formを継承すること System.Runtime.InteropServices.DllImport("user32.dll") private static extern short GetKeyState(int nVirtKey); //外部定義指定 Image back0 Image.FromFile("backb2.bmp"); //背景画像①ファイルを得る Image back1 Image.FromFile("backb2.bmp"); //背景画像②ファイルを得る static Image plin Image.FromFile("player.gif"); //自機画像(通常)ファイルを得る static Image plil Image.FromFile("playerl.gif"); //自機画像(左寄)ファイルを得る static Image plir Image.FromFile("playerr.gif"); //自機画像(右寄)ファイルを得る infos P new infos(300, 395, plin); //自機の情報を生成 const int xspeed 10; //左右移動速度 int yspeed 1; //縦スクロール速度 int backc 0; //背景画像のつなぎ目のY座標 const int pbnum 8; //自弾の最大数 int pbcd 0; //自弾の冷却タイマ const int pbcdn 5; //自弾の冷却タイマ数 infos PBA new infospbnum; //自弾の配列 static Image ecnin Image.FromFile("enemy.gif"); //敵砲台画像ファイルを得る const int ecnum 4; //敵砲台数 infos ECA new infosecnum; //敵砲台の配列font colorblue> int eccd new intecnum; //【追加】敵砲台の冷却タイマ const int eccdn 10; //【追加】敵砲台の冷却タイマ数 //static Image ebimg Image.FromFile("ebullet.gif"); //【削除】敵弾画像ファイルを得る const int ebnum 8; //【追加】敵弾の最大数 infos EBA new infosebnum; //【追加】敵弾の配列/font> //共通部品(衝突判定用) private bool isHit(infos a, infos b) { //中心距離を用いた衝突判定 return Math.Pow(a.MX - b.MX, 2) + Math.Pow(a.MY - b.MY, 2) < Math.Pow(a.IL + b.IL, 2); } //共通部品(オブジェクトを指定方向へ45度単位で回転させる) private Point getPoints(infos i, int x, int y) { //オブジェクトiを座標(x,y)方向へ回転するための座標配列を返す int x0, y0, x1, y1, x2, y2; //左上、右上、左下の座標 x0 x1 x2 i.X; //仮にオブジェクトiの左上座標としておく y0 y1 y2 i.Y; //〃 double r Math.Atan2(y - i.MY, x - i.MX); //座標xyとの中心座標角度(ラジアン)を得る double d (Math.Sqrt(2.0) - 1.0) / 2.0; //斜めにした場合にはみ出す部分の割合 if (r > -Math.PI * 7 / 8 && r < -Math.PI * 5 / 8) { //左上 x0 - (int)(i.I.Width * d); y0 + i.I.Height / 2; x1 + i.I.Width / 2; y1 - (int)(i.I.Height * d); x2 x1; y2 + (int)(i.I.Height * (1 + d)); } else if (r > -Math.PI * 5 / 8 && r < -Math.PI * 3 / 8) { //上 x1 + i.I.Width; y2 + i.I.Height; } else if (r > -Math.PI * 3 / 8 && r < -Math.PI * 1 / 8) { //右上 x0 + i.I.Width / 2; y0 - (int)(i.I.Height * 0.2); x1 + (int)(i.I.Width * (1 + d)); y1 + i.I.Height / 2; x2 - (int)(i.I.Width * d); y2 y1; } else if (r > -Math.PI * 1 / 8 && r < Math.PI * 1 / 8) { //右 x0 + i.I.Width; x1 x0; y1 + i.I.Height; } else if (r > Math.PI * 1 / 8 && r < Math.PI * 3 / 8) { //右下 x0 + (int)(i.I.Width * (1 + d)); y0 + i.I.Height / 2; x1 + i.I.Width / 2; y1 + (int)(i.I.Height * (1 + d)); x2 x1; y2 - (int)(i.I.Height * d); } else if (r > Math.PI * 3 / 8 && r < Math.PI * 5 / 8) { //下 x0 + i.I.Width; y0 + i.I.Height; y1 y0; x2 x0; } else if (r > Math.PI * 5 / 8 && r < Math.PI * 7 / 8) { //左下 x0 + i.I.Width / 2; y0 + (int)(i.I.Height * 1.2); x1 - (int)(i.I.Width * d); y1 + i.I.Height / 2; x2 + (int)(i.I.Width * (1 + d)); y2 y1; } else { //左 y0 + i.I.Height; x2 + i.I.Width; y2 y0; } Point pts {new Point(x0, y0), new Point(x1, y1), new Point(x2, y2)}; return pts; } //描画処理(主処理などからシステム経由で呼び出される) protected override void OnPaint(PaintEventArgs e) { //描画処理のオーバーライド base.OnPaint(e); //冒頭で基本クラスのメソッド内容を実行 if (backc ! 0) e.Graphics.DrawImage(back0, 0, backc - back0.Height); //背景画像①を描画 if (backc ! back1.Height) e.Graphics.DrawImage(back1, 0, backc); //背景画像②を描画 for (int i 0; i < pbnum; i++) { //全自弾分繰返す if (PBAi.EX) e.Graphics.DrawImage(PBAi.I, PBAi.X, PBAi.Y); //自弾画像を描画 }font colorblue> for (int i 0; i < ebnum; i++) { //【以下追加】全敵弾分繰返す if (EBAi.EX) e.Graphics.DrawImage(EBAi.I, EBAi.X, EBAi.Y); //【変更】敵弾画像を描画 }/font> for (int i 0; i < ecnum; i++) { //全敵砲台分繰返す if (ECAi.EX) e.Graphics.DrawImage(ECAi.I, getPoints(ECAi, P.MX, P.MY)); //自機に向くように描画 } e.Graphics.DrawImage(P.I, P.X, P.Y); //自機画像を描画 } //主処理(タイマーに呼び出される) private void play(object o, EventArgs ea){ //キー入力 if (GetKeyState((int)Keys.Escape) < 0) { //Escキーが押されている this.Close(); //終了 } P.I plin; //自機画像(通常)を用いる if (GetKeyState((int)Keys.Left) < 0) { //←キーが押されている P.I plil; //自機画像(左寄)を用いる if(P.SX > -xspeed) P.SX - 2; //左移動の速度を設定 } else if (GetKeyState((int)Keys.Right) < 0) { //→キーが押されている P.I plir; //自機画像(右寄)を用いる if(P.SX < xspeed) P.SX + 2; //右移動の速度を設定 } if (GetKeyState((int)Keys.Up) < 0) { //↑キーが押されている if(P.SY > -yspeed) P.SY - 5; //上移動の速度を設定 } else if (GetKeyState((int)Keys.Down) < 0) { //↓キーが押されている if(P.SY < yspeed) P.SY + 5; //下移動の速度を設定 } if (GetKeyState((int)Keys.Space) < 0) { //スペースキーが押されている if (pbcd < 0) { //冷却完了? int i 0; //発射可能な自弾の添字 for (; i < pbnum; i++) { //全自弾分繰返す if(!PBAi.EX) break; //自弾iが発射可能なら繰返し終了 } if (i < pbnum) { //発射可能な自弾があれば PBAi.X P.X + P.I.Width / 2 - PBAi.I.Width / 2; //X座標は自機の中央 PBAi.Y P.Y - PBAi.I.Height; //Y座標は自機の直上 PBAi.EX true; //自弾i有 } pbcd pbcdn; //冷却タイマをセット } else { //冷却中? pbcd--; //冷却タイマカウントダウン } } //自機の移動 if (P.SX < 0) { //左へ移動中? P.X + P.SX; //左へ移動 if (P.X < 0) { //左端を超えたら P.X 0; //左端に固定 P.SX 0; //移動停止 } else { P.SX++; //減速 } } else if (P.SX > 0) { //右へ移動中? P.X + P.SX; //右へ移動 if (P.X > back0.Width - P.I.Width) { //右端を超えたら P.X back0.Width - P.I.Width; //右端に固定 P.SX 0; //移動停止 } else { P.SX--; //減速 } } if (P.SY < 0) { //上へ移動中? P.Y + P.SY; //上へ移動 if (P.Y < 0) { //上端を超えたら P.Y 0; //上端に固定 P.SY 0; //移動停止 } else { P.SY++; //減速 } } else if (P.SY > 0) { //下へ移動中? P.Y + P.SY; //下へ移動 if (P.Y > back0.Height - P.I.Height) { //下端を超えたら P.Y back0.Height - P.I.Height; //下端に固定 P.SY 0; //移動停止 } else { P.SY--; //減速 } } //自弾の移動と衝突判定 for (int i 0; i < pbnum; i++) { //全自弾分繰返す if (PBAi.EX) { //自弾iがあれば PBAi.Y + PBAi.SY; //上へ移動 if (PBAi.Y < -PBAi.I.Height) { //上端を超えたら PBAi.EX false; //自弾iを消す } else { for (int j 0; j < ecnum; j++) { //全敵砲台分繰返す if (ECAj.EX && isHit(PBAi, ECAj)) { //自弾iと敵砲台jが衝突? PBAi.EX false; //自弾iを消す ECAj.EX false; //敵砲台jを消す } } } } } //敵弾の移動font colorblue> for (int i 0; i < ebnum; i++) { //【追加】全敵弾分繰返す if (EBAi.EX){ //【以下変更】敵弾があれば EBAi.X EBAi.X + (int)(Math.Cos(EBAi.SR) * 10); //角度から移動先X座標を得る EBAi.Y EBAi.Y + (int)(Math.Sin(EBAi.SR) * 10); //角度から移動先Y座標を得る if (EBAi.MX < 0 || EBAi.MX > 640 || EBAi.MY < 0 || EBAi.MY > 480) EBAi.EX false; //出たら消す } }/font> //敵砲台の移動と敵弾の出現 for (int i 0; i < ecnum; i++) { //全敵砲台分繰返すfont colorblue> if (ECAi.EX && ECAi.MY > 0 && ECAi.MY < 400) { //【変更】敵砲台iが範囲内に出現中? if (eccdi < 0) { //【以下追加&変更】冷却完了? int j 0; //発射可能な敵弾の添字 for (; j < ebnum; j++) { //全敵弾分繰返す if(!EBAj.EX) break; //敵弾jが発射可能なら繰返し終了 } if (j < ebnum) { //発射可能な敵弾があれば EBAj.X ECAi.MX - EBAj.I.Width / 2; //敵砲台iの中央 EBAj.Y ECAi.MY - EBAj.I.Height / 2; //〃 EBAj.SR Math.Atan2(P.MY - EBAj.MY, P.MX - EBAj.MX); //座標xyとの中心座標角度(ラジアン)を得る EBAj.EX true; //敵弾出現 } eccdi eccdn; //冷却タイマをセット } else { //冷却中? eccdi--; //冷却タイマカウントダウン } }/font> if (ECAi.Y < back0.Height * 2 - ecnin.Height) { //敵砲台が下端に達するまで ECAi.Y + yspeed; //下方に移動 } else { //下端に達したら ECAi.Y -ecnin.Height; //上方から出現 ECAi.EX true; //敵砲台iを再出現 } } //背景の移動 backc (backc < back0.Height) ? backc + yspeed : 0; //背景画像のつなぎ目を下げる Invalidate(); //画面に反映 } //コンストラクタ mostsimple() { SetStyle(ControlStyles.DoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true); //ダブルバッファリングを設定 for (int i 0; i < pbnum; i++) { //全自弾分繰返す PBAi new infos(0, 0, Image.FromFile("bullet.gif"), false); //自弾の情報を生成 } ECA0 new infos(115, 440, Image.FromFile("enemy.gif"), true); //敵砲台生成(仮) ECA1 new infos(462, 440, ECA0.I, true); //〃 ECA2 new infos(115, 920, ECA0.I, true); //〃 ECA3 new infos(462, 920, ECA0.I, true); //〃font colorblue> for (int i 0; i < ebnum; i++) { //【以下追加】全敵弾分繰返す EBAi new infos(0, 0, Image.FromFile("ebullet.gif"), false); //敵弾の情報を生成 }/font> Timer t new Timer(); //タイマーオブジェクトの生成 t.Tick + new EventHandler(play); //タイマにメソッドを指定する t.Interval 20; //タイマ間隔を指定 t.Start(); //タイマを起動 } //起動処理 static void Main() { mostsimple ms new mostsimple(); //自オブジェクトを生成 ms.StartPosition FormStartPosition.Manual; //表示位置の調整を可能にする ms.Location new Point(0, 0); //フォーム左上端の位置を指定 ms.Size new Size(660, 520); //幅(640->660)と高さ(480->520)を指定 ms.Text "Game"; //タイトルを設定 ms.ControlBox false; ms.FormBorderStyle FormBorderStyle.Fixed3D; Application.Run(ms); //自オブジェクトへの参照をRunに与えることで開く }}/pre>p>ゲーム開発演習(28) フォント文字列の表示/p>pre>・C#のGraphics.DrawStringメソッドを用いると、画面上に文字列を描画できる. このメソッドにはいくつかのオーバロードがあるが、ここでは下記のシグニチャを用いる。 Graphics.DrawString(文字列, フォント, ブラシ, X座標, Y座標);・フォントはFontクラスのインスタンスで、コンストラクタにはいくつかのオーバロードがあるが、ここでは下記のシグニチャを用いる。 Font 参照変数 new Font(フォントファミリ名, ポイント数, フォントスタイル);・フォントファミリ名として一般的に使えるのはArial、MS 明朝、メイリオ など。・ポイント数は整数で指定・フォントスタイルは、FontStyleクラスの静的メンバで、 Regular、Bold(太字)、Italic(斜体)、Underline(下線)、Strikeout(打消線)のどれかを指定。・ブラシは描画するテキストの色とテクスチャを決定するもので、Brushクラスのインスタンスを用いる。 ここではBrushを継承する単色のSolidBrushクラスを用いる。 SolidBrush 参照変数 new SolidBrush(色);・色はColorクラスの静的メンバで、White、Black、Red、Cyanなどが指定できる。 例: SolidBrush sb new SolidBrush(Color.Cyan); //テキストの塗りつぶし指定を生成 Font f new Font(メイリオ, 40, FontStyle.Bold); //フォント指定を生成 e.Graphics.DrawString(Hello, f, sb, 150, 190); //文字列「Hello」を描画/pre>p>ゲーム開発演習(29) ゲームモード/p>pre>・開始画面やゲームオーバー画面をプレイ画面と同様な動きを持たせて表示する場合・ゲームの状態を示す変数(例:int gamemode)を定義して、各処理においてこの値を参照すると良い・ゲーム状態の遷移によって、この値を変更する 例:開始時=0、ゲーム中=1、ゲームオーバー=9・ゲーム中でも特殊な状態(例:自機が被弾して無敵状態)も、同様で良い(同じ変数を用いるかどうかはケースバイケース)/pre>p>演習34 開始画面/p>pre>・起動時に適当な開始画面を表示し、Enterキーでプレイ画面に遷移しよう/pre>p>作成例/p>pre>//演習34 開始画面using System; //EventArgsクラス用using System.Windows.Forms; //Formクラス用using System.Drawing; //Point,Size,Imageクラス用//構造体struct infos { //画面上の物体の情報を持つ構造体 int x, y; //XY座標 Image i; //画像への参照 int sx; //X速度 int sy; //y速度 double sr; //移動角度 bool ex; //有無 public int X { get { return x; } set { x value; } } //プロパティ public int Y { get { return y; } set { y value; } } //〃 public int SX { get { return sx; } set { sx value; } } //〃 public int SY { get { return sy; } set { sy value; } } //〃 public bool EX { get { return ex; } set { ex value; } } //〃 public double SR { get { return sr; } set { sr value; } } //〃 public Image I { get { return i; } set { i value; } } //〃 public int MX { get { return x + i.Width / 2; } } //中心X座標を返す〃 public int MY { get { return y + i.Height / 2; } } //中心Y座標を返す〃 public double IL { get { //内径(幅と高さの小さい方の半分)を返す〃 return (i.Width < i.Height) ? i.Width / 2.0 : i.Height / 2.0; } } public infos(int x, int y, Image i) { //コンストラクタ(自機) this.x x; this.y y; this.i i; sx 0; sy 0; sr 0; this.ex true; } public infos(int x, int y, Image i, bool ex) { //コンストラクタ(自弾、敵弾) this.x x; this.y y; this.i i; sx 0; sy -10; sr 0; this.ex ex; }}//クラス定義class mostsimple : Form { //Formを継承すること System.Runtime.InteropServices.DllImport("user32.dll") private static extern short GetKeyState(int nVirtKey); //外部定義指定 Image back0 Image.FromFile("backb2.bmp"); //背景画像①ファイルを得る Image back1 Image.FromFile("backb2.bmp"); //背景画像②ファイルを得る static Image plin Image.FromFile("player.gif"); //自機画像(通常)ファイルを得る static Image plil Image.FromFile("playerl.gif"); //自機画像(左寄)ファイルを得る static Image plir Image.FromFile("playerr.gif"); //自機画像(右寄)ファイルを得る infos P new infos(300, 395, plin); //自機の情報を生成 const int xspeed 10; //左右移動速度 int yspeed 1; //縦スクロール速度 int backc 0; //背景画像のつなぎ目のY座標 const int pbnum 8; //自弾の最大数 int pbcd 0; //自弾の冷却タイマ const int pbcdn 5; //自弾の冷却タイマ数 infos PBA new infospbnum; //自弾の配列 static Image ecnin Image.FromFile("enemy.gif"); //敵砲台画像ファイルを得る const int ecnum 4; //敵砲台数 infos ECA new infosecnum; //敵砲台の配列 int eccd new intecnum; //敵砲台の冷却タイマ const int eccdn 10; //敵砲台の冷却タイマ数 const int ebnum 8; //敵弾の最大数 infos EBA new infosebnum; //敵弾の配列font colorblue> int gamemode 0; //【追加】ゲームモード(開始時:0,ゲーム中:1,ゲームオーバー:9)/font> //共通部品(衝突判定用) private bool isHit(infos a, infos b) { //中心距離を用いた衝突判定 return Math.Pow(a.MX - b.MX, 2) + Math.Pow(a.MY - b.MY, 2) < Math.Pow(a.IL + b.IL, 2); } //共通部品(オブジェクトを指定方向へ45度単位で回転させる) private Point getPoints(infos i, int x, int y) { //オブジェクトiを座標(x,y)方向へ回転するための座標配列を返す int x0, y0, x1, y1, x2, y2; //左上、右上、左下の座標 x0 x1 x2 i.X; //仮にオブジェクトiの左上座標としておく y0 y1 y2 i.Y; //〃 double r Math.Atan2(y - i.MY, x - i.MX); //座標xyとの中心座標角度(ラジアン)を得る double d (Math.Sqrt(2.0) - 1.0) / 2.0; //斜めにした場合にはみ出す部分の割合 if (r > -Math.PI * 7 / 8 && r < -Math.PI * 5 / 8) { //左上 x0 - (int)(i.I.Width * d); y0 + i.I.Height / 2; x1 + i.I.Width / 2; y1 - (int)(i.I.Height * d); x2 x1; y2 + (int)(i.I.Height * (1 + d)); } else if (r > -Math.PI * 5 / 8 && r < -Math.PI * 3 / 8) { //上 x1 + i.I.Width; y2 + i.I.Height; } else if (r > -Math.PI * 3 / 8 && r < -Math.PI * 1 / 8) { //右上 x0 + i.I.Width / 2; y0 - (int)(i.I.Height * 0.2); x1 + (int)(i.I.Width * (1 + d)); y1 + i.I.Height / 2; x2 - (int)(i.I.Width * d); y2 y1; } else if (r > -Math.PI * 1 / 8 && r < Math.PI * 1 / 8) { //右 x0 + i.I.Width; x1 x0; y1 + i.I.Height; } else if (r > Math.PI * 1 / 8 && r < Math.PI * 3 / 8) { //右下 x0 + (int)(i.I.Width * (1 + d)); y0 + i.I.Height / 2; x1 + i.I.Width / 2; y1 + (int)(i.I.Height * (1 + d)); x2 x1; y2 - (int)(i.I.Height * d); } else if (r > Math.PI * 3 / 8 && r < Math.PI * 5 / 8) { //下 x0 + i.I.Width; y0 + i.I.Height; y1 y0; x2 x0; } else if (r > Math.PI * 5 / 8 && r < Math.PI * 7 / 8) { //左下 x0 + i.I.Width / 2; y0 + (int)(i.I.Height * 1.2); x1 - (int)(i.I.Width * d); y1 + i.I.Height / 2; x2 + (int)(i.I.Width * (1 + d)); y2 y1; } else { //左 y0 + i.I.Height; x2 + i.I.Width; y2 y0; } Point pts {new Point(x0, y0), new Point(x1, y1), new Point(x2, y2)}; return pts; } //描画処理(主処理などからシステム経由で呼び出される) protected override void OnPaint(PaintEventArgs e) { //描画処理のオーバーライド base.OnPaint(e); //冒頭で基本クラスのメソッド内容を実行 if (backc ! 0) e.Graphics.DrawImage(back0, 0, backc - back0.Height); //背景画像①を描画 if (backc ! back1.Height) e.Graphics.DrawImage(back1, 0, backc); //背景画像②を描画font colorblue> if (gamemode 0) { //【以下追加】ゲームモードが開始? SolidBrush sb new SolidBrush(Color.Cyan); //テキストの塗りつぶし指定を生成 Font f new Font("メイリオ", 40, FontStyle.Bold); //フォント指定を生成 e.Graphics.DrawString("Zaviel", f, sb, 210, 190); //ゲーム名を描画 sb new SolidBrush(Color.Yellow); //テキストの塗りつぶし指定を生成 f new Font("メイリオ", 20, FontStyle.Bold); //フォント指定を生成 e.Graphics.DrawString("Hit Enter to Start !", f, sb, 180, 320); //メッセージを描画 } else { //【追加】ゲームモードがプレイ中以降?/font> for (int i 0; i < pbnum; i++) { //全自弾分繰返す if (PBAi.EX) e.Graphics.DrawImage(PBAi.I, PBAi.X, PBAi.Y); //自弾画像を描画 } for (int i 0; i < ebnum; i++) { //全敵弾分繰返す if (EBAi.EX) e.Graphics.DrawImage(EBAi.I, EBAi.X, EBAi.Y); //敵弾画像を描画 } for (int i 0; i < ecnum; i++) { //全敵砲台分繰返す if (ECAi.EX) e.Graphics.DrawImage(ECAi.I, getPoints(ECAi, P.MX, P.MY)); //自機に向くように描画 } e.Graphics.DrawImage(P.I, P.X, P.Y); //自機画像を描画 } } //主処理(タイマーに呼び出される) private void play(object o, EventArgs ea){ //キー入力 if (GetKeyState((int)Keys.Escape) < 0) { //Escキーが押されている this.Close(); //終了 }font colorblue> if (gamemode 0) { //【以下追加】ゲームモードが開始? if (GetKeyState((int)Keys.Enter) < 0) { //Enterキーが押されている gamemode 1; //ゲームモードをゲーム中に } } else { //【追加】/font> P.I plin; //自機画像(通常)を用いる if (GetKeyState((int)Keys.Left) < 0) { //←キーが押されている P.I plil; //自機画像(左寄)を用いる if(P.SX > -xspeed) P.SX - 2; //左移動の速度を設定 } else if (GetKeyState((int)Keys.Right) < 0) { //→キーが押されている P.I plir; //自機画像(右寄)を用いる if(P.SX < xspeed) P.SX + 2; //右移動の速度を設定 } if (GetKeyState((int)Keys.Up) < 0) { //↑キーが押されている if(P.SY > -yspeed) P.SY - 5; //上移動の速度を設定 } else if (GetKeyState((int)Keys.Down) < 0) { //↓キーが押されている if(P.SY < yspeed) P.SY + 5; //下移動の速度を設定 } if (GetKeyState((int)Keys.Space) < 0) { //スペースキーが押されている if (pbcd < 0) { //冷却完了? int i 0; //発射可能な自弾の添字 for (; i < pbnum; i++) { //全自弾分繰返す if(!PBAi.EX) break; //自弾iが発射可能なら繰返し終了 } if (i < pbnum) { //発射可能な自弾があれば PBAi.X P.X + P.I.Width / 2 - PBAi.I.Width / 2; //X座標は自機の中央 PBAi.Y P.Y - PBAi.I.Height; //Y座標は自機の直上 PBAi.EX true; //自弾i有 } pbcd pbcdn; //冷却タイマをセット } else { //冷却中? pbcd--; //冷却タイマカウントダウン } } //自機の移動 if (P.SX < 0) { //左へ移動中? P.X + P.SX; //左へ移動 if (P.X < 0) { //左端を超えたら P.X 0; //左端に固定 P.SX 0; //移動停止 } else { P.SX++; //減速 } } else if (P.SX > 0) { //右へ移動中? P.X + P.SX; //右へ移動 if (P.X > back0.Width - P.I.Width) { //右端を超えたら P.X back0.Width - P.I.Width; //右端に固定 P.SX 0; //移動停止 } else { P.SX--; //減速 } } if (P.SY < 0) { //上へ移動中? P.Y + P.SY; //上へ移動 if (P.Y < 0) { //上端を超えたら P.Y 0; //上端に固定 P.SY 0; //移動停止 } else { P.SY++; //減速 } } else if (P.SY > 0) { //下へ移動中? P.Y + P.SY; //下へ移動 if (P.Y > back0.Height - P.I.Height) { //下端を超えたら P.Y back0.Height - P.I.Height; //下端に固定 P.SY 0; //移動停止 } else { P.SY--; //減速 } } //自弾の移動と衝突判定 for (int i 0; i < pbnum; i++) { //全自弾分繰返す if (PBAi.EX) { //自弾iがあれば PBAi.Y + PBAi.SY; //上へ移動 if (PBAi.Y < -PBAi.I.Height) { //上端を超えたら PBAi.EX false; //自弾iを消す } else { for (int j 0; j < ecnum; j++) { //全敵砲台分繰返す if (ECAj.EX && isHit(PBAi, ECAj)) { //自弾iと敵砲台jが衝突? PBAi.EX false; //自弾iを消す ECAj.EX false; //敵砲台jを消す } } } } } //敵弾の移動 for (int i 0; i < ebnum; i++) { //全敵弾分繰返す if (EBAi.EX){ //敵弾があれば EBAi.X EBAi.X + (int)(Math.Cos(EBAi.SR) * 10); //角度から移動先X座標を得る EBAi.Y EBAi.Y + (int)(Math.Sin(EBAi.SR) * 10); //角度から移動先Y座標を得る if (EBAi.MX < 0 || EBAi.MX > 640 || EBAi.MY < 0 || EBAi.MY > 480) EBAi.EX false; //出たら消す } } //敵砲台の移動と敵弾の出現 for (int i 0; i < ecnum; i++) { //全敵砲台分繰返す if (ECAi.EX && ECAi.MY > 0 && ECAi.MY < 400) { //敵砲台iが範囲内に出現中? if (eccdi < 0) { //冷却完了? int j 0; //発射可能な敵弾の添字 for (; j < ebnum; j++) { //全敵弾分繰返す if(!EBAj.EX) break; //敵弾jが発射可能なら繰返し終了 } if (j < ebnum) { //発射可能な敵弾があれば EBAj.X ECAi.MX - EBAj.I.Width / 2; //敵砲台iの中央 EBAj.Y ECAi.MY - EBAj.I.Height / 2; //〃 EBAj.SR Math.Atan2(P.MY - EBAj.MY, P.MX - EBAj.MX); //座標xyとの中心座標角度(ラジアン)を得る EBAj.EX true; //敵弾出現 } eccdi eccdn; //冷却タイマをセット } else { //冷却中? eccdi--; //冷却タイマカウントダウン } } if (ECAi.Y < back0.Height * 2 - ecnin.Height) { //敵砲台が下端に達するまで ECAi.Y + yspeed; //下方に移動 } else { //下端に達したら ECAi.Y -ecnin.Height; //上方から出現 ECAi.EX true; //敵砲台iを再出現 } } } //背景の移動 backc (backc < back0.Height) ? backc + yspeed : 0; //背景画像のつなぎ目を下げる Invalidate(); //画面に反映 } //コンストラクタ mostsimple() { SetStyle(ControlStyles.DoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true); //ダブルバッファリングを設定 for (int i 0; i < pbnum; i++) { //全自弾分繰返す PBAi new infos(0, 0, Image.FromFile("bullet.gif"), false); //自弾の情報を生成 } ECA0 new infos(115, 440, Image.FromFile("enemy.gif"), true); //敵砲台生成(仮) ECA1 new infos(462, 440, ECA0.I, true); //〃 ECA2 new infos(115, 920, ECA0.I, true); //〃 ECA3 new infos(462, 920, ECA0.I, true); //〃 for (int i 0; i < ebnum; i++) { //全敵弾分繰返す EBAi new infos(0, 0, Image.FromFile("ebullet.gif"), false); //敵弾の情報を生成 } Timer t new Timer(); //タイマーオブジェクトの生成 t.Tick + new EventHandler(play); //タイマにメソッドを指定する t.Interval 20; //タイマ間隔を指定 t.Start(); //タイマを起動 } //起動処理 static void Main() { mostsimple ms new mostsimple(); //自オブジェクトを生成 ms.StartPosition FormStartPosition.Manual; //表示位置の調整を可能にする ms.Location new Point(0, 0); //フォーム左上端の位置を指定 ms.Size new Size(660, 520); //幅(640->660)と高さ(480->520)を指定 ms.Text "Game"; //タイトルを設定 ms.ControlBox false; ms.FormBorderStyle FormBorderStyle.Fixed3D; Application.Run(ms); //自オブジェクトへの参照をRunに与えることで開く }}/pre> /div>!-- .entry-content --> footer classentry-footer> span classcat-links>カテゴリー: a hrefhttps://ha205.rundog.org/?cat5 relcategory>講師より/a>/span>span classcomments-link>ディスカッション:a hrefhttps://ha205.rundog.org/?p1956#respond classcomments-link >コメントを残す/a>/span> /footer>!-- .entry-footer -->/article>!-- #post-## -->article classpost-1953 post type-post status-publish format-standard hentry category-5> header classentry-header> h2 classentry-title>a hrefhttps://ha205.rundog.org/?p1953 relbookmark>講義メモ 前半の続き/a>/h2> div classentry-meta> span classposted-on>投稿日: a hrefhttps://ha205.rundog.org/?p1953 relbookmark>time classentry-date published datetime2021-09-04T12:37:48+09:00>2021年9月4日/time>time classupdated datetime2021-09-04T12:44:51+09:00>2021年9月4日/time>/a>/span>span classbyline> 投稿者: span classauthor vcard>a classurl fn n hrefhttps://ha205.rundog.org/?author1>maurundog/a>/span>/span> /div>!-- .entry-meta --> /header>!-- .entry-header --> div classentry-content> p>p.405 LINQとは/p>pre>・SQL(データベース操作言語)に近い構文により、データ構造への検索を行う仕掛け・SQLによる検索のポイント:関数やメソッドとは異なり、データ構造が返されるので、受け取り側の扱いに注意・LINQの対象:配列などのデータ構造、XML文書など/pre>p>p.406 C#のクエリ/p>pre>・SQLにおけるクエリ(問い合わせ)構文例: SELECT 項目名,… FROM テーブル名 WHERE 抽出条件 ORDER BY 整列条件・C#では、特定のジェネリックインタフェースを型とするデータ構造(コレクション)に対して、SQLに似たLINQの構文を記述できる・LINQ用のジェネリックインタフェース IEnumerable<T>:T型のコレクションに対する単純な反復処理をサポートする列挙子を提供 (System.Collections.Generic名前空間) IQueryable<T>:T型のコレクションに対するクエリを評価する機能を提供 (LINQ専用でSystem.Linq名前空間)・LINQの利用はIEnumerable<T>を用いるが、内部的にIQueryable<T>が用いられるため、上記2つの名前空間が必要・クエリはIEnumerable<T>型の変数を定義し、クエリ式で初期化することで問合せ用オブジェクトを生成して行う IEnumerable<データ型> 変数 クエリ式;・クエリ式の書式例: from 項目名 in 対象名 where 条件式 select 項目名・配列の場合の書式例: from 作業変数 in 配列名 where 作業変数を用いた条件式 select 作業変数・得られた結果に対して、foreach構文で値の取り出しを行えばよい/pre>p>p.407 簡単なデータ抽出プログラム/p>pre>・LINQの利用には、VS2008以降が必要・補足:VS2010以降では参照設定の設定は不要(規定値になっている)/pre>p>p.408 linq01.cs 解説/p>pre>// p.408 linq01.cs 解説using System;font colorblue>using System.Linq; //内部的にIQueryable<T>用using System.Collections.Generic; //IEnumerable<T>用/font>class linq01 { public static void Main() { int numbers new int { -3, 4, 1, 2, -6, 3, 100, -25};font colorblue> // クエリの作成(int型配列なので型パラメータはint) IEnumerable<int> q from n in numbers where n > 0 select n; // クエリの実行(int型配列なので作業変数はint型) foreach (int x in q) Console.WriteLine(x);/font> }}/pre> /div>!-- .entry-content --> footer classentry-footer> span classcat-links>カテゴリー: a hrefhttps://ha205.rundog.org/?cat5 relcategory>講師より/a>/span>span classcomments-link>ディスカッション:a hrefhttps://ha205.rundog.org/?p1953#respond classcomments-link >コメントを残す/a>/span> /footer>!-- .entry-footer -->/article>!-- #post-## -->article classpost-1939 post type-post status-publish format-standard hentry category-5> header classentry-header> h2 classentry-title>a hrefhttps://ha205.rundog.org/?p1939 relbookmark>講義メモ/a>/h2> div classentry-meta> span classposted-on>投稿日: a hrefhttps://ha205.rundog.org/?p1939 relbookmark>time classentry-date published datetime2021-09-04T11:08:12+09:00>2021年9月4日/time>time classupdated datetime2021-09-04T12:03:39+09:00>2021年9月4日/time>/a>/span>span classbyline> 投稿者: span classauthor vcard>a classurl fn n hrefhttps://ha205.rundog.org/?author1>maurundog/a>/span>/span> /div>!-- .entry-meta --> /header>!-- .entry-header --> div classentry-content> p>前半:p.395「名前空間のネスト定義の省略」からbr />後半:全砲台から発射、開始画面(フォント文字列の表示)、ゲームモード/p>p>p.395 名前空間のネスト定義の省略/p>pre>・名前空間をネストした場合、内側の名前空間の定義内容は、名前空間名をドットでつないだ形の名前空間定義で表記できる・書式例: namespace 外側の名前空間名.内側の名前空間名 {…}・この時、外側の名前空間に所属する要素は、別途定義すること・また、usingの対象範囲が異なるので、都度定義すること/pre>p>p.396 namespace04.cs 解説/p>pre>// p.396 namespace04.cs 解説namespace Animal { //Animal名前空間の定義 using System; class Dog { //Animal.Dogクラスの定義 public string name; public void show() { System.Console.WriteLine("犬の名前は{0}です", name); } }}font colorblue>namespace Animal.Mammal.Cat { //ネストしている名前空間の定義/font> using System; // Animal名前空間でusing System;とあるがここでもう一度 class cat { //Animal.Mammal.Cat.catクラスの定義 public string name; public void show() { Console.WriteLine("猫の名前は{0}です", name); } }}namespace MyNamespace { //MyNamespace名前空間の定義 class Namespace03 { //MyNamespace.Namespace03クラスの定義 public static void Main() {font colorblue> Animal.Mammal.Cat.cat mycat new Animal.Mammal.Cat.cat();/font> mycat.name "マイケル"; mycat.show(); Animal.Dog mydog new Animal.Dog(); mydog.name "ポチ"; mydog.show(); } }}/pre>p>p.398 プリプロセッサ/p>pre>・C/C++から引き継がれた機能で、コンパイラ(C#システム)に対して前処理を指示できる機能・指示に用いる文字列をプリプロセッサディレクティブという・コンパイラ(C#システム)はプリプロセッサディレクティブに従って、ソースファイルを編集した結果をコンパイルする・プリプロセッサディレクティブにより、ソースの一部分をコンパイル対象から動的に除外するなどの制御が可能(コメントアウトトラブルの防止などに有効)・「#define シンボル」でシンボル文字列の定義をしておき、対象部分を「#if シンボル」と「#endif」で囲んでおけば、 #defineを削除することで、対象部分をコンパイルから除外できる・複数のシンボルを定義して論理関係演算子「&&」「||」でAND/OR指定が可能・論理否定演算子「!」を用いてNOT指定が可能・定義済みのシンボルは「#undef シンボル」で無効化できる・ただし、#defineによるマクロ定義はC#では不可 ※ C/C++の「#ifndef」を用いたインクルードガ-ドも不可/pre>p>p.400 preprocess01.cs 解説/p>pre>// p.400 preprocess01.cs 解説#define TESTusing System;class preprocess01 { public static void Main() {font colorblue>#if TEST/font> Console.WriteLine("テストです"); //シンボルTESTがあれば対象font colorblue>#endif#if (TEST && TEST2) //AND(かつ)/font> Console.WriteLine("ここは、TESTとTEST2が定義されていないとコンパイルされません");font colorblue>#endif#if (TEST || TEST2) //OR(または)/font> Console.WriteLine("ここは、TESTかTEST2が定義されていればコンパイルされます");font colorblue>#endif#if TEST2/font> Console.WriteLine("ここは、TEST2が定義されているとコンパイルされます");font colorblue>#endif/font> }}/pre>p>演習16-1 プリプロセッサの論理関係演算子/p>pre>・preprocess01.csを適当に書き換えて、 NOT指定が可能なこと AND指定とOR指定が同時に利用でき、ANDが優先であること 数式と同様にカッコで優先順を操作できること を確認しよう/pre>p>作成例/p>pre>// 演習16-1 プリプロセッサの論理関係演算子#define TEST#define TEST3using System;class preprocess01 { public static void Main() {font colorblue>#if !TEST/font> Console.WriteLine("テストです"); //シンボルTESTがなければ対象font colorblue>#endif#if (TEST3 || TEST && TEST2) //AND(かつ)が優先/font> Console.WriteLine("TESTとTEST2の両方か、TEST3が定義されている");font colorblue>#endif#if ((TEST3 || TEST) && TEST2) //カッコで優先順を操作/font> Console.WriteLine("TEST3とTESTのどちらかと、TEST2が定義されている");font colorblue>#endif/font> }}/pre>p>p.401 その他のプリプロセッサディレクティブ/p>pre>・「#if シンボル」と「#endif」の間に1つだけ「#else」を記述できる(if文のelseと同様)・「#if シンボル」と「#endif」の間にいくつでも「#elif シンボル」を記述できる(if文のelse ifと同様)/pre>p>演習16-2 その他のプリプロセッサディレクティブ/p>pre>・preprocess01.csを適当に書き換えて「#else」「#elif シンボル」の動作を確認しよう/pre>p>作成例/p>pre>// 演習16-2 その他のプリプロセッサディレクティブ#define TEST#define TEST3using System;class preprocess01 { public static void Main() {#if TEST Console.WriteLine("TESTが定義されている");font colorblue>#elif TEST2/font> Console.WriteLine("TESTではなくTEST2が定義されている");font colorblue>#elif TEST3/font> Console.WriteLine("TEST/TEST2ではなくTEST3が定義されている");font colorblue>#else/font> Console.WriteLine("TESTもTEST2もTEST3も定義されていない");#endif }}/pre>p>p.402 Conditional属性/p>pre>・C#独自の「メソッドの前にコンパイル対象にするかどうかの条件を付ける仕掛け」・Conditional属性を付けたメソッドを条件付きメソッドという・条件はプリプロセッサディレクティブと同様にシンボルを用いる・書式: Conditional(シンボル)・指定には、using System.Diagnostics; が必要・戻り値型がvoidで、オーバライドしていないメソッドであれば、条件付きメソッドにできる・条件付きメソッドがコンパイル対象から外れる場合、自動的に呼び出し部分も除外される・よって、プリプロセッサディレクティブの「#if」構文より使いやすい/pre>p>p.402 conditional01.cs 解説/p>pre>// p.402 conditional01.cs 解説using System;font colorblue>using System.Diagnostics; //Conditional属性用/font>class MyClass { public string name;font colorblue> Conditional("TEST") //シンボルTESTがないとshowメソッドは除外/font> public void show() { Console.WriteLine(name); }}class conditional01 { public static void Main() { MyClass mc new MyClass(); mc.name "マイケル"; mc.show(); //showメソッドが除外されたらこの行も除外される }}/pre>p>演習16-3 複数のConditional属性/p>pre>・conditional01.csを適当に書き換えて下記を確認しよう 複数のConditional属性をANDやORで指定することはできない しかし、1つのメソッドの前に複数のConditional属性を指定可能で、OR扱いになる/pre>p>作成例/p>pre>// 演習16-3 複数のConditional属性font colorblue>#define TEST/font>using System;using System.Diagnostics; //Conditional属性用class MyClass { public string name; Conditional("TEST") //シンボルTESTfont colorblue> Conditional("TEST2") //またはシンボルTEST2がないとshowメソッドは除外/font> public void show() { Console.WriteLine(name); }}class conditional01 { public static void Main() { MyClass mc new MyClass(); mc.name "マイケル"; mc.show(); //showメソッドが除外されたらこの行も除外される }}/pre> /div>!-- .entry-content --> footer classentry-footer> span classcat-links>カテゴリー: a hrefhttps://ha205.rundog.org/?cat5 relcategory>講師より/a>/span>span classcomments-link>ディスカッション:a hrefhttps://ha205.rundog.org/?p1939#respond classcomments-link >コメントを残す/a>/span> /footer>!-- .entry-footer -->/article>!-- #post-## -->article classpost-1923 post type-post status-publish format-standard hentry category-5> header classentry-header> h2 classentry-title>a hrefhttps://ha205.rundog.org/?p1923 relbookmark>今週の話題/a>/h2> div classentry-meta> span classposted-on>投稿日: a hrefhttps://ha205.rundog.org/?p1923 relbookmark>time classentry-date published datetime2021-09-04T10:35:39+09:00>2021年9月4日/time>time classupdated datetime2021-09-04T11:00:14+09:00>2021年9月4日/time>/a>/span>span classbyline> 投稿者: span classauthor vcard>a classurl fn n hrefhttps://ha205.rundog.org/?author1>maurundog/a>/span>/span> /div>!-- .entry-meta --> /header>!-- .entry-header --> div classentry-content> p>販売本数ランキング 今週首位は「月姫 -A piece of blue glass moon-」a hrefhttps://rundog.org/bbs/link.cgi?rhttps://www.famitsu.com/ranking/game-sales/ targettop relnoopener noreferrer>GO!/a>br />6本の新作発表も予告! THQ Nordic設立10周年を記念した初の公式デジタルショーケース開催決定 a hrefhttps://rundog.org/bbs/link.cgi?rhttps://www.gamebusiness.jp/article/2021/09/03/19013.html targettop relnoopener noreferrer>GO!/a>br />「PlayStation Showcase 2021」日本時間9月10日配信―ホリデーシーズン以降発売のPS5新作タイトル紹介 a hrefhttps://rundog.org/bbs/link.cgi?rhttps://www.gamebusiness.jp/article/2021/09/03/19012.html targettop relnoopener noreferrer>GO!/a>br />夢の共演、再び!「CAPCOMvs.手塚治虫CHARACTERS’」、池袋PARCOで10月1日より開催 a hrefhttps://rundog.org/bbs/link.cgi?rhttps://www.gamebusiness.jp/article/2021/09/02/19010.html targettop relnoopener noreferrer>GO!/a>br />「東京ゲームショウ2021 オンライン」公式番組タイムテーブル発表!スクエニやカプコンなど、計46番組を予定 a hrefhttps://rundog.org/bbs/link.cgi?rhttps://www.gamebusiness.jp/article/2021/09/02/19009.html targettop relnoopener noreferrer>GO!/a>br />Windows11が10月5日リリース決定!ゲーム機能を大幅強化 a hrefhttps://rundog.org/bbs/link.cgi?rhttps://www.gamebusiness.jp/article/2021/09/01/19006.html targettop relnoopener noreferrer>GO!/a>br />ゲームでプロの兵士に「リアル感」を持たせる動作とは?専門家が徹底実演解説する「銃器と装備、戦術戦技」【CEDEC2021】a hrefhttps://rundog.org/bbs/link.cgi?rhttps://www.gamebusiness.jp/article/2021/09/01/19002.html targettop relnoopener noreferrer>GO!/a>/p>p>Steam成人向けゲームで「白銀ノエル」「宝鐘マリン」らファンアートを無断使用―ホロライブ「事実関係を踏まえた上で対応を検討」a hrefhttps://rundog.org/bbs/link.cgi?rhttps://www.gamebusiness.jp/article/2021/09/01/19000.html targettop relnoopener noreferrer>GO!/a>br />中国が未成年に対するネットゲーム規制強化―利用は「週末と祝日の夜8時から9時のみ」a hrefhttps://rundog.org/bbs/link.cgi?rhttps://www.gamebusiness.jp/article/2021/08/31/18995.html targettop relnoopener noreferrer>GO!/a>br />Apple、児童ポルノ検知機能追加を延期 プライバシー抗議受け a hrefhttps://rundog.org/bbs/link.cgi?rhttps://www.itmedia.co.jp/news/articles/2109/04/news028.html targettop relnoopener noreferrer>GO!/a>br />国内のNFTマーケットに攻撃 一部のNFT作品が流出か 運営は補填を発表 a hrefhttps://rundog.org/bbs/link.cgi?rhttps://www.itmedia.co.jp/news/articles/2109/03/news151.html targettop relnoopener noreferrer>GO!/a>br />Google検索の“勝手にタイトルを変える仕様”に波紋 消費者庁などの注意喚起ページが逆の詐欺タイトルに a hrefhttps://rundog.org/bbs/link.cgi?rhttps://www.itmedia.co.jp/news/articles/2108/30/news131.html targettop relnoopener noreferrer>GO!/a>br />AWSで障害、ネットワーク接続に問題 GitHubも同時期に一時アクセスしづらい状態に【復旧済み】a hrefhttps://rundog.org/bbs/link.cgi?rhttps://www.itmedia.co.jp/news/articles/2109/02/news088.html targettop relnoopener noreferrer>GO!/a>br />石倉デジタル監、有料素材のサンプル画像を無断転載で謝罪 個人サイトを一時閉鎖、Twitterアカウントも一時非公開に a hrefhttps://rundog.org/bbs/link.cgi?rhttps://www.itmedia.co.jp/news/articles/2109/03/news123.html targettop relnoopener noreferrer>GO!/a>/p> /div>!-- .entry-content --> footer classentry-footer> span classcat-links>カテゴリー: a hrefhttps://ha205.rundog.org/?cat5 relcategory>講師より/a>/span>span classcomments-link>ディスカッション:a hrefhttps://ha205.rundog.org/?p1923#respond classcomments-link >コメントを残す/a>/span> /footer>!-- .entry-footer -->/article>!-- #post-## --> nav classnavigation posts-navigation rolenavigation aria-label投稿ナビゲーション> h2 classscreen-reader-text>投稿ナビゲーション/h2> div classnav-links>div classnav-previous>a hrefhttps://ha205.rundog.org/?paged2 >← 古い投稿/a>/div>/div> /nav>/div>!-- .content-area -->aside classsidebar-1 widget-area> section classwidget widget_text>h3 classwidget-title>ご注意/h3> div classtextwidget>p>このサイトのURLの公開・転載やリンクは、strong>明示・暗示を問わず絶対にしないでください/strong>。また、お仕事先のネットワークからの利用はお止め下さい。事前の連絡無くサービスを終了する場合があります。/p>/div> /section>section classwidget widget_search>h3 classwidget-title>サイト内検索/h3>form rolesearch methodget classsearch-form actionhttps://ha205.rundog.org/> label> span classscreen-reader-text>検索:/span> input typesearch classsearch-field placeholder検索… value names /> /label> input typesubmit classsearch-submit value検索 /> /form>/section>section classwidget widget_text>h3 classwidget-title>リンク/h3> div classtextwidget>p>a hrefhttps://ha205.rundog.org/wp-content/uploads/2020/10/ha205.pdf targettop relnoopener noreferrer>スケジュール/a>br />a hrefhttps://ha205.rundog.org/wp-content/uploads/2020/11/NekoCS3_Sample_ed.zip>ソース一式/a>br />a hrefhttps://rundog.org/bbs/link.cgi?rhttp://neko.sbcr.jp/neko_c_sharp.html targettop relnoopener noreferrer>テキスト公式ページ/a>br />a hrefhttps://rundog.org/bbs/link.cgi?rhttps://msdn.microsoft.com/library targettop relnoopener noreferrer>APIリファレンス/a>br />a hrefhttps://rundog.org/bbs/link.cgi?rhttp://www.wisdomsoft.jp/479.html targettop relnoopener noreferrer><参考>C#ゲームプログラミング/a>br />a hrefhttps://rundog.org/bbs/link.cgi?rhttps://rundog.org/ targettop relnoopener noreferrer>講師のサイト/a>br />a hrefhttps://rundog.org/bbs/link.cgi?rhttps://ameblo.jp/maurundog/ targettop relnoopener noreferrer>ブログ/a>br />a hrefhttps://rundog.org/bbs/link.cgi?rhttps://twitter.com/maurundog/ targettop relnoopener noreferrer>Twitter/a>br />a hrefhttps://rundog.org/bbs/link.cgi?rhttps://www.facebook.com/maurundog targettop relnoopener noreferrer>Facebook/a>br />a hrefhttps://rundog.org/bbs/link.cgi?rhttps://www.youtube.com/channel/UC6VurzFHXlwkOKaTUj352cg/videos targettop relnoopener noreferrer>Youtubeチャンネル/a>/p>/div> /section>/aside>!-- #secondary --> /div>!-- .wrapper --> /div>!-- .site-content --> footer classsite-footer> div classwrapper> div classsite-info> Theme: a relnofollow hrefhttps://olympusthemes.com/themes/scaffold/>Scaffold/a> by Danny Cooper /div>!-- .site-info --> /div>!-- .wrapper --> /footer>!-- .site-footer -->script typetext/javascript srchttp://ha205.rundog.org/wp-includes/js/dist/vendor/wp-polyfill.min.js?ver7.4.4 idwp-polyfill-js>/script>script typetext/javascript idwp-polyfill-js-after>( fetch in window ) || document.write( script srchttp://ha205.rundog.org/wp-includes/js/dist/vendor/wp-polyfill-fetch.min.js?ver3.0.0>/scr + ipt> );( document.contains ) || document.write( script srchttp://ha205.rundog.org/wp-includes/js/dist/vendor/wp-polyfill-node-contains.min.js?ver3.42.0>/scr + ipt> );( window.DOMRect ) || document.write( script srchttp://ha205.rundog.org/wp-includes/js/dist/vendor/wp-polyfill-dom-rect.min.js?ver3.42.0>/scr + ipt> );( window.URL && window.URL.prototype && window.URLSearchParams ) || document.write( script srchttp://ha205.rundog.org/wp-includes/js/dist/vendor/wp-polyfill-url.min.js?ver3.6.4>/scr + ipt> );( window.FormData && window.FormData.prototype.keys ) || document.write( script srchttp://ha205.rundog.org/wp-includes/js/dist/vendor/wp-polyfill-formdata.min.js?ver3.0.12>/scr + ipt> );( Element.prototype.matches && Element.prototype.closest ) || document.write( script srchttp://ha205.rundog.org/wp-includes/js/dist/vendor/wp-polyfill-element-closest.min.js?ver2.0.2>/scr + ipt> );/script>script typetext/javascript idcontact-form-7-js-extra>/* !CDATA */var wpcf7 {api:{root:https:\/\/ha205.rundog.org\/index.php?rest_route\/,namespace:contact-form-7\/v1}};/* > *//script>script typetext/javascript srchttp://ha205.rundog.org/wp-content/plugins/contact-form-7/includes/js/index.js?ver5.4.1 idcontact-form-7-js>/script>script typetext/javascript srchttp://ha205.rundog.org/wp-content/plugins/drag-and-drop-multiple-file-upload-contact-form-7/assets/js/codedropz-uploader-min.js?ver1.3.5.9 idcodedropz-uploader-js>/script>script typetext/javascript iddnd-upload-cf7-js-extra>/* !CDATA */var dnd_cf7_uploader {ajax_url:https:\/\/ha205.rundog.org\/wp-admin\/admin-ajax.php,ajax_nonce:a29076426d,drag_n_drop_upload:{tag:h4,text:\u3053\u3053\u306b\u30d5\u30a1\u30a4\u30eb\u3092\u30c9\u30ed\u30c3\u30d7\u3059\u308b,or_separator:\u304b,browse:\u3053\u3053\u3092\u30af\u30ea\u30c3\u30af\u3057\u3066\u30d5\u30a1\u30a4\u30eb\u3092\u9078\u3093\u3067\u304f\u3060\u3055\u3044,server_max_error:The uploaded file exceeds the maximum upload size of your server.,large_file:Uploaded file is too large,inavalid_type:Uploaded file is not allowed for file type,max_file_limit:Note : Some of the files are not uploaded ( Only %count% files allowed ),required:This field is required.,delete:{text:deleting,title:Remove}},dnd_text_counter:of,disable_btn:};/* > *//script>script typetext/javascript srchttp://ha205.rundog.org/wp-content/plugins/drag-and-drop-multiple-file-upload-contact-form-7/assets/js/dnd-upload-cf7.js?ver1.3.5.9 iddnd-upload-cf7-js>/script>script typetext/javascript srchttp://ha205.rundog.org/wp-content/themes/scaffold/assets/js/navigation.js?ver1.3.1 idscaffold-navigation-js>/script>script typetext/javascript srchttp://ha205.rundog.org/wp-includes/js/wp-embed.min.js?ver5.5.15 idwp-embed-js>/script>/div>!-- .site-wrapper -->/body>/html>
Port 443
HTTP/1.1 200 OKDate: Sat, 14 Sep 2024 13:17:38 GMTContent-Type: text/html; charsetUTF-8Transfer-Encoding: chunkedConnection: keep-aliveServer: ApacheX-Powered-By: PHP/7.4.33Link: https://ha205.rundog.org/index.php?rest_route/>; relhttps://api.w.org/Vary: Range,Accept-EncodingAccept-Ranges: none !DOCTYPE html>html langja>head> meta charsetUTF-8> meta nameviewport contentwidthdevice-width, initial-scale1> link relprofile hrefhttp://gmpg.org/xfn/11> title>https://ha205.rundog.org/ – for trainees of Hirano's class only/title>meta namerobots contentnoindex,nofollow />link reldns-prefetch href//s.w.org />link relalternate typeapplication/rss+xml titlehttps://ha205.rundog.org/ » フィード hrefhttps://ha205.rundog.org />link relalternate typeapplication/rss+xml titlehttps://ha205.rundog.org/ » コメントフィード hrefhttps://ha205.rundog.org/?feedcomments-rss2 /> script typetext/javascript> window._wpemojiSettings {baseUrl:https:\/\/s.w.org\/images\/core\/emoji\/13.0.0\/72x72\/,ext:.png,svgUrl:https:\/\/s.w.org\/images\/core\/emoji\/13.0.0\/svg\/,svgExt:.svg,source:{concatemoji:https:\/\/ha205.rundog.org\/wp-includes\/js\/wp-emoji-release.min.js?ver5.5.15}}; !function(e,a,t){var n,r,o,ia.createElement(canvas),pi.getContext&&i.getContext(2d);function s(e,t){var aString.fromCharCode;p.clearRect(0,0,i.width,i.height),p.fillText(a.apply(this,e),0,0);ei.toDataURL();return p.clearRect(0,0,i.width,i.height),p.fillText(a.apply(this,t),0,0),ei.toDataURL()}function c(e){var ta.createElement(script);t.srce,t.defert.typetext/javascript,a.getElementsByTagName(head)0.appendChild(t)}for(oArray(flag,emoji),t.supports{everything:!0,everythingExceptFlag:!0},r0;ro.length;r++)t.supportsorfunction(e){if(!p||!p.fillText)return!1;switch(p.textBaselinetop,p.font600 32px Arial,e){caseflag:return s(127987,65039,8205,9895,65039,127987,65039,8203,9895,65039)?!1:!s(55356,56826,55356,56819,55356,56826,8203,55356,56819)&&!s(55356,57332,56128,56423,56128,56418,56128,56421,56128,56430,56128,56423,56128,56447,55356,57332,8203,56128,56423,8203,56128,56418,8203,56128,56421,8203,56128,56430,8203,56128,56423,8203,56128,56447);caseemoji:return!s(55357,56424,8205,55356,57212,55357,56424,8203,55356,57212)}return!1}(or),t.supports.everythingt.supports.everything&&t.supportsor,flag!or&&(t.supports.everythingExceptFlagt.supports.everythingExceptFlag&&t.supportsor);t.supports.everythingExceptFlagt.supports.everythingExceptFlag&&!t.supports.flag,t.DOMReady!1,t.readyCallbackfunction(){t.DOMReady!0},t.supports.everything||(nfunction(){t.readyCallback()},a.addEventListener?(a.addEventListener(DOMContentLoaded,n,!1),e.addEventListener(load,n,!1)):(e.attachEvent(onload,n),a.attachEvent(onreadystatechange,function(){completea.readyState&&t.readyCallback()})),(nt.source||{}).concatemoji?c(n.concatemoji):n.wpemoji&&n.twemoji&&(c(n.twemoji),c(n.wpemoji)))}(window,document,window._wpemojiSettings); /script> style typetext/css>img.wp-smiley,img.emoji { display: inline !important; border: none !important; box-shadow: none !important; height: 1em !important; width: 1em !important; margin: 0 .07em !important; vertical-align: -0.1em !important; background: none !important; padding: 0 !important;}/style> link relstylesheet idwp-block-library-css hrefhttps://ha205.rundog.org/wp-includes/css/dist/block-library/style.min.css?ver5.5.15 typetext/css mediaall />link relstylesheet iddnd-upload-cf7-css hrefhttps://ha205.rundog.org/wp-content/plugins/drag-and-drop-multiple-file-upload-contact-form-7/assets/css/dnd-upload-cf7.css?ver1.3.5.9 typetext/css mediaall />link relstylesheet idcontact-form-7-css hrefhttps://ha205.rundog.org/wp-content/plugins/contact-form-7/includes/css/styles.css?ver5.4.1 typetext/css mediaall />link relstylesheet idscaffold-style-css hrefhttps://ha205.rundog.org/wp-content/themes/scaffold/style.css?ver1.3.1 typetext/css mediaall />script typetext/javascript srchttps://ha205.rundog.org/wp-includes/js/jquery/jquery.js?ver1.12.4-wp idjquery-core-js>/script>link relhttps://api.w.org/ hrefhttps://ha205.rundog.org/index.php?rest_route/ />link relEditURI typeapplication/rsd+xml titleRSD hrefhttps://ha205.rundog.org/xmlrpc.php?rsd />link relwlwmanifest typeapplication/wlwmanifest+xml hrefhttps://ha205.rundog.org/wp-includes/wlwmanifest.xml /> meta namegenerator contentWordPress 5.5.15 /> style> .menu-1 { background-color: #ba4a34; } .menu-1 li:hover, .menu-1 li.focus { background-color: #a1311b; } .menu-1 ul ul li { background-color: #881802; } .menu-1 .sub-menu li:hover { background-color: #6f0000; } .menu-toggle { background-color: #ba4a34; } .toggled .menu-toggle { background-color: #881802; } /style> style typetext/css> .site-title a { color: #000000; } .site-header { min-height: 173px; } /style> link relicon hrefhttps://ha205.rundog.org/wp-content/uploads/2020/10/cropped-Rロゴ1-32x32.jpg sizes32x32 />link relicon hrefhttps://ha205.rundog.org/wp-content/uploads/2020/10/cropped-Rロゴ1-192x192.jpg sizes192x192 />link relapple-touch-icon hrefhttps://ha205.rundog.org/wp-content/uploads/2020/10/cropped-Rロゴ1-180x180.jpg />meta namemsapplication-TileImage contenthttps://ha205.rundog.org/wp-content/uploads/2020/10/cropped-Rロゴ1-270x270.jpg />/head>body classhome blog hfeed>div classsite-wrapper> header classsite-header> div classwrapper> div classsite-branding> h1 classsite-title> a hrefhttps://ha205.rundog.org/ relhome> https://ha205.rundog.org/ /a> /h1> p classsite-description> for trainees of Hirano's class only /p> /div>!-- .site-branding --> /div>!-- .wrapper --> /header>!-- .site-header --> nav idsite-navigation classmenu-1> div classwrapper> button classmenu-toggle aria-controlssite-menu aria-expandedfalse> サイトナビゲーション /button> div classmenu-%e3%83%a1%e3%82%a4%e3%83%b3-container>ul idsite-menu classmenu>li idmenu-item-36 classmenu-item menu-item-type-post_type menu-item-object-page menu-item-36>a hrefhttps://ha205.rundog.org/?page_id34>提出フォーム/a>/li>li idmenu-item-520 classmenu-item menu-item-type-custom menu-item-object-custom menu-item-520>a hrefhttps://ha205.rundog.org/wp-content/uploads/2021/04/ha205.pdf>スケジュール/a>/li>li idmenu-item-333 classmenu-item menu-item-type-custom menu-item-object-custom menu-item-333>a hrefhttps://ameblo.jp/maurundog/>講師ブログ/a>/li>li idmenu-item-334 classmenu-item menu-item-type-custom menu-item-object-custom menu-item-334>a hrefhttps://www.youtube.com/channel/UC6VurzFHXlwkOKaTUj352cg/videos>講師のYoutubeチャンネル/a>/li>/ul>/div> /div>!-- .wrapper -->/nav>!-- .menu-1 --> div classsite-content> div classwrapper>div classcontent-area> article classpost-2017 post type-post status-publish format-standard hentry category-5> header classentry-header> h2 classentry-title>a hrefhttps://ha205.rundog.org/?p2017 relbookmark>最終回の講義メモ/a>/h2> div classentry-meta> span classposted-on>投稿日: a hrefhttps://ha205.rundog.org/?p2017 relbookmark>time classentry-date published datetime2021-09-11T13:34:15+09:00>2021年9月11日/time>time classupdated datetime2021-09-11T17:31:02+09:00>2021年9月11日/time>/a>/span>span classbyline> 投稿者: span classauthor vcard>a classurl fn n hrefhttps://ha205.rundog.org/?author1>maurundog/a>/span>/span> /div>!-- .entry-meta --> /header>!-- .entry-header --> div classentry-content> p>講義の進行にご協力をありがとうございましたbr />・このサイトはある限り残しますがいつかは消えます。br />・講義内容についてのお問合せは、終了後も受け付けます。ただし、お返事には時間がかかる場合があります。br />講義メモ:a hrefhttps://ha205.rundog.org/wp-content/uploads/2021/09/講義メモ20210911.zip>講義メモ20210911.zip/a>/p> /div>!-- .entry-content --> footer classentry-footer> span classcat-links>カテゴリー: a hrefhttps://ha205.rundog.org/?cat5 relcategory>講師より/a>/span>span classcomments-link>ディスカッション:a hrefhttps://ha205.rundog.org/?p2017#respond classcomments-link >コメントを残す/a>/span> /footer>!-- .entry-footer -->/article>!-- #post-## -->article classpost-2010 post type-post status-publish format-standard hentry category-5> header classentry-header> h2 classentry-title>a hrefhttps://ha205.rundog.org/?p2010 relbookmark>講義メモ 後半:ゲーム開発演習/a>/h2> div classentry-meta> span classposted-on>投稿日: a hrefhttps://ha205.rundog.org/?p2010 relbookmark>time classentry-date published datetime2021-09-11T12:56:55+09:00>2021年9月11日/time>time classupdated datetime2021-09-11T13:30:35+09:00>2021年9月11日/time>/a>/span>span classbyline> 投稿者: span classauthor vcard>a classurl fn n hrefhttps://ha205.rundog.org/?author1>maurundog/a>/span>/span> /div>!-- .entry-meta --> /header>!-- .entry-header --> div classentry-content> p>演習35 自機の被弾によるゲームオーバー/p>pre>・ゲームオーバーをゲームモード=9で示す・自機と敵弾の衝突判定を行い、被弾していたらゲームオーバーとする・ゲームオーバー画面では自機は炎上状態とする・炎上用の画像の例: img srchttps://rundog.org/si/burn.gif> 60×60・ゲームオーバー画面では敵砲台、敵弾は表示しない(背景のスクロールは行う)/pre>p>作成例/p>pre>//演習35 ゲームオーバーusing System; //EventArgsクラス用using System.Windows.Forms; //Formクラス用using System.Drawing; //Point,Size,Imageクラス用//構造体struct infos { //画面上の物体の情報を持つ構造体 int x, y; //XY座標 Image i; //画像への参照 int sx; //X速度 int sy; //y速度 double sr; //移動角度 bool ex; //有無 public int X { get { return x; } set { x value; } } //プロパティ public int Y { get { return y; } set { y value; } } //〃 public int SX { get { return sx; } set { sx value; } } //〃 public int SY { get { return sy; } set { sy value; } } //〃 public bool EX { get { return ex; } set { ex value; } } //〃 public double SR { get { return sr; } set { sr value; } } //〃 public Image I { get { return i; } set { i value; } } //〃 public int MX { get { return x + i.Width / 2; } } //中心X座標を返す〃 public int MY { get { return y + i.Height / 2; } } //中心Y座標を返す〃 public double IL { get { //内径(幅と高さの小さい方の半分)を返す〃 return (i.Width < i.Height) ? i.Width / 2.0 : i.Height / 2.0; } } public infos(int x, int y, Image i) { //コンストラクタ(自機) this.x x; this.y y; this.i i; sx 0; sy 0; sr 0; this.ex true; } public infos(int x, int y, Image i, bool ex) { //コンストラクタ(自弾、敵弾) this.x x; this.y y; this.i i; sx 0; sy -10; sr 0; this.ex ex; }}//クラス定義class mostsimple : Form { //Formを継承すること System.Runtime.InteropServices.DllImport("user32.dll") private static extern short GetKeyState(int nVirtKey); //外部定義指定 Image back0 Image.FromFile("backb2.bmp"); //背景画像①ファイルを得る Image back1 Image.FromFile("backb2.bmp"); //背景画像②ファイルを得る static Image plin Image.FromFile("player.gif"); //自機画像(通常)ファイルを得る static Image plil Image.FromFile("playerl.gif"); //自機画像(左寄)ファイルを得る static Image plir Image.FromFile("playerr.gif"); //自機画像(右寄)ファイルを得る infos P new infos(300, 395, plin); //自機の情報を生成 const int xspeed 10; //左右移動速度 int yspeed 1; //縦スクロール速度 int backc 0; //背景画像のつなぎ目のY座標 const int pbnum 8; //自弾の最大数 int pbcd 0; //自弾の冷却タイマ const int pbcdn 5; //自弾の冷却タイマ数 infos PBA new infospbnum; //自弾の配列 static Image ecnin Image.FromFile("enemy.gif"); //敵砲台画像ファイルを得る const int ecnum 4; //敵砲台数 infos ECA new infosecnum; //敵砲台の配列 int eccd new intecnum; //敵砲台の冷却タイマ const int eccdn 15; //敵砲台の冷却タイマ数 const int ebnum 8; //敵弾の最大数 infos EBA new infosebnum; //敵弾の配列 int gamemode 0; //ゲームモード(開始時:0,ゲーム中:1,ゲームオーバー:9)font colorblue> static Image plib Image.FromFile("burn.gif"); //【追加】自機炎上画像ファイルを得る/font> //共通部品(衝突判定用) private bool isHit(infos a, infos b) { //中心距離を用いた衝突判定 return Math.Pow(a.MX - b.MX, 2) + Math.Pow(a.MY - b.MY, 2) < Math.Pow(a.IL + b.IL, 2); } //共通部品(オブジェクトを指定方向へ45度単位で回転させる) private Point getPoints(infos i, int x, int y) { //オブジェクトiを座標(x,y)方向へ回転するための座標配列を返す int x0, y0, x1, y1, x2, y2; //左上、右上、左下の座標 x0 x1 x2 i.X; //仮にオブジェクトiの左上座標としておく y0 y1 y2 i.Y; //〃 double r Math.Atan2(y - i.MY, x - i.MX); //座標xyとの中心座標角度(ラジアン)を得る double d (Math.Sqrt(2.0) - 1.0) / 2.0; //斜めにした場合にはみ出す部分の割合 if (r > -Math.PI * 7 / 8 && r < -Math.PI * 5 / 8) { //左上 x0 - (int)(i.I.Width * d); y0 + i.I.Height / 2; x1 + i.I.Width / 2; y1 - (int)(i.I.Height * d); x2 x1; y2 + (int)(i.I.Height * (1 + d)); } else if (r > -Math.PI * 5 / 8 && r < -Math.PI * 3 / 8) { //上 x1 + i.I.Width; y2 + i.I.Height; } else if (r > -Math.PI * 3 / 8 && r < -Math.PI * 1 / 8) { //右上 x0 + i.I.Width / 2; y0 - (int)(i.I.Height * 0.2); x1 + (int)(i.I.Width * (1 + d)); y1 + i.I.Height / 2; x2 - (int)(i.I.Width * d); y2 y1; } else if (r > -Math.PI * 1 / 8 && r < Math.PI * 1 / 8) { //右 x0 + i.I.Width; x1 x0; y1 + i.I.Height; } else if (r > Math.PI * 1 / 8 && r < Math.PI * 3 / 8) { //右下 x0 + (int)(i.I.Width * (1 + d)); y0 + i.I.Height / 2; x1 + i.I.Width / 2; y1 + (int)(i.I.Height * (1 + d)); x2 x1; y2 - (int)(i.I.Height * d); } else if (r > Math.PI * 3 / 8 && r < Math.PI * 5 / 8) { //下 x0 + i.I.Width; y0 + i.I.Height; y1 y0; x2 x0; } else if (r > Math.PI * 5 / 8 && r < Math.PI * 7 / 8) { //左下 x0 + i.I.Width / 2; y0 + (int)(i.I.Height * 1.2); x1 - (int)(i.I.Width * d); y1 + i.I.Height / 2; x2 + (int)(i.I.Width * (1 + d)); y2 y1; } else { //左 y0 + i.I.Height; x2 + i.I.Width; y2 y0; } Point pts {new Point(x0, y0), new Point(x1, y1), new Point(x2, y2)}; return pts; } //描画処理(主処理などからシステム経由で呼び出される) protected override void OnPaint(PaintEventArgs e) { //描画処理のオーバーライド base.OnPaint(e); //冒頭で基本クラスのメソッド内容を実行 if (backc ! 0) e.Graphics.DrawImage(back0, 0, backc - back0.Height); //背景画像①を描画 if (backc ! back1.Height) e.Graphics.DrawImage(back1, 0, backc); //背景画像②を描画 if (gamemode 0) { //ゲームモードが開始? SolidBrush sb new SolidBrush(Color.Cyan); //テキストの塗りつぶし指定を生成 Font f new Font("メイリオ", 40, FontStyle.Bold); //フォント指定を生成 e.Graphics.DrawString("Zaviel", f, sb, 210, 190); //ゲーム名を描画 sb new SolidBrush(Color.Yellow); //テキストの塗りつぶし指定を生成 f new Font("メイリオ", 20, FontStyle.Bold); //フォント指定を生成 e.Graphics.DrawString("Hit Enter to Start !", f, sb, 180, 320); //メッセージを描画font colorblue> } else if (gamemode 1) { //【変更】プレイ中?/font> for (int i 0; i < pbnum; i++) { //全自弾分繰返す if (PBAi.EX) e.Graphics.DrawImage(PBAi.I, PBAi.X, PBAi.Y); //自弾画像を描画 } for (int i 0; i < ebnum; i++) { //全敵弾分繰返す if (EBAi.EX) e.Graphics.DrawImage(EBAi.I, EBAi.X, EBAi.Y); //敵弾画像を描画 } for (int i 0; i < ecnum; i++) { //全敵砲台分繰返す if (ECAi.EX) e.Graphics.DrawImage(ECAi.I, getPoints(ECAi, P.MX, P.MY)); //自機に向くように描画 } e.Graphics.DrawImage(P.I, P.X, P.Y); //自機画像を描画font colorblue> } else { //【以下追加】ゲームオーバー? e.Graphics.DrawImage(plib, P.X, P.Y); //自機炎上画像を描画 SolidBrush sb new SolidBrush(Color.Orange); //テキストの塗りつぶし指定を生成 Font f new Font("メイリオ", 40, FontStyle.Bold); //フォント指定を生成 e.Graphics.DrawString("Game Over", f, sb, 155, 190); //ゲームオーバーを描画 }/font> } //主処理(タイマーに呼び出される) private void play(object o, EventArgs ea){ //キー入力 if (GetKeyState((int)Keys.Escape) < 0) { //Escキーが押されている this.Close(); //終了 } if (gamemode 0) { //ゲームモードが開始? if (GetKeyState((int)Keys.Enter) < 0) { //Enterキーが押されている gamemode 1; //ゲームモードをゲーム中に }font colorblue> } else if (gamemode 1) { //【変更】プレイ中?/font> P.I plin; //自機画像(通常)を用いる if (GetKeyState((int)Keys.Left) < 0) { //←キーが押されている P.I plil; //自機画像(左寄)を用いる if(P.SX > -xspeed) P.SX - 2; //左移動の速度を設定 } else if (GetKeyState((int)Keys.Right) < 0) { //→キーが押されている P.I plir; //自機画像(右寄)を用いる if(P.SX < xspeed) P.SX + 2; //右移動の速度を設定 } if (GetKeyState((int)Keys.Up) < 0) { //↑キーが押されている if(P.SY > -yspeed) P.SY - 5; //上移動の速度を設定 } else if (GetKeyState((int)Keys.Down) < 0) { //↓キーが押されている if(P.SY < yspeed) P.SY + 5; //下移動の速度を設定 } if (GetKeyState((int)Keys.Space) < 0) { //スペースキーが押されている if (pbcd < 0) { //冷却完了? int i 0; //発射可能な自弾の添字 for (; i < pbnum; i++) { //全自弾分繰返す if(!PBAi.EX) break; //自弾iが発射可能なら繰返し終了 } if (i < pbnum) { //発射可能な自弾があれば PBAi.X P.X + P.I.Width / 2 - PBAi.I.Width / 2; //X座標は自機の中央 PBAi.Y P.Y - PBAi.I.Height; //Y座標は自機の直上 PBAi.EX true; //自弾i有 } pbcd pbcdn; //冷却タイマをセット } else { //冷却中? pbcd--; //冷却タイマカウントダウン } } //自機の移動 if (P.SX < 0) { //左へ移動中? P.X + P.SX; //左へ移動 if (P.X < 0) { //左端を超えたら P.X 0; //左端に固定 P.SX 0; //移動停止 } else { P.SX++; //減速 } } else if (P.SX > 0) { //右へ移動中? P.X + P.SX; //右へ移動 if (P.X > back0.Width - P.I.Width) { //右端を超えたら P.X back0.Width - P.I.Width; //右端に固定 P.SX 0; //移動停止 } else { P.SX--; //減速 } } if (P.SY < 0) { //上へ移動中? P.Y + P.SY; //上へ移動 if (P.Y < 0) { //上端を超えたら P.Y 0; //上端に固定 P.SY 0; //移動停止 } else { P.SY++; //減速 } } else if (P.SY > 0) { //下へ移動中? P.Y + P.SY; //下へ移動 if (P.Y > back0.Height - P.I.Height) { //下端を超えたら P.Y back0.Height - P.I.Height; //下端に固定 P.SY 0; //移動停止 } else { P.SY--; //減速 } } //自弾の移動と衝突判定 for (int i 0; i < pbnum; i++) { //全自弾分繰返す if (PBAi.EX) { //自弾iがあれば PBAi.Y + PBAi.SY; //上へ移動 if (PBAi.Y < -PBAi.I.Height) { //上端を超えたら PBAi.EX false; //自弾iを消す } else { for (int j 0; j < ecnum; j++) { //全敵砲台分繰返す if (ECAj.EX && isHit(PBAi, ECAj)) { //自弾iと敵砲台jが衝突? PBAi.EX false; //自弾iを消す ECAj.EX false; //敵砲台jを消す } } } } } //敵弾の移動と衝突判定 for (int i 0; i < ebnum; i++) { //全敵弾分繰返す if (EBAi.EX){ //敵弾があれば EBAi.X EBAi.X + (int)(Math.Cos(EBAi.SR) * 10); //角度から移動先X座標を得る EBAi.Y EBAi.Y + (int)(Math.Sin(EBAi.SR) * 10); //角度から移動先Y座標を得るfont colorblue> if (EBAi.MX < 0 || EBAi.MX > 640 || EBAi.MY < 0 || EBAi.MY > 480) { //【変更】/font> EBAi.EX false; //出たら消すfont colorblue> } else if (isHit(EBAi, P)) { //【以下追加】敵弾iと自機が衝突? gamemode 9; //ゲームオーバーにする }/font> } } //敵砲台の移動と敵弾の出現 for (int i 0; i < ecnum; i++) { //全敵砲台分繰返す if (ECAi.EX && ECAi.MY > 0 && ECAi.MY < 400) { //敵砲台iが範囲内に出現中? if (eccdi < 0) { //冷却完了? int j 0; //発射可能な敵弾の添字 for (; j < ebnum; j++) { //全敵弾分繰返す if(!EBAj.EX) break; //敵弾jが発射可能なら繰返し終了 } if (j < ebnum) { //発射可能な敵弾があれば EBAj.X ECAi.MX - EBAj.I.Width / 2; //敵砲台iの中央 EBAj.Y ECAi.MY - EBAj.I.Height / 2; //〃 EBAj.SR Math.Atan2(P.MY - EBAj.MY, P.MX - EBAj.MX); //座標xyとの中心座標角度(ラジアン)を得る EBAj.EX true; //敵弾出現 } eccdi eccdn; //冷却タイマをセット } else { //冷却中? eccdi--; //冷却タイマカウントダウン } } if (ECAi.Y < back0.Height * 2 - ecnin.Height) { //敵砲台が下端に達するまで ECAi.Y + yspeed; //下方に移動 } else { //下端に達したら ECAi.Y -ecnin.Height; //上方から出現 ECAi.EX true; //敵砲台iを再出現 } } } //背景の移動 backc (backc < back0.Height) ? backc + yspeed : 0; //背景画像のつなぎ目を下げる Invalidate(); //画面に反映 } //コンストラクタ mostsimple() { SetStyle(ControlStyles.DoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true); //ダブルバッファリングを設定 for (int i 0; i < pbnum; i++) { //全自弾分繰返す PBAi new infos(0, 0, Image.FromFile("bullet.gif"), false); //自弾の情報を生成 } ECA0 new infos(115, 440, Image.FromFile("enemy.gif"), true); //敵砲台生成(仮) ECA1 new infos(462, 440, ECA0.I, true); //〃 ECA2 new infos(115, 920, ECA0.I, true); //〃 ECA3 new infos(462, 920, ECA0.I, true); //〃 for (int i 0; i < ebnum; i++) { //全敵弾分繰返す EBAi new infos(0, 0, Image.FromFile("ebullet.gif"), false); //敵弾の情報を生成 } Timer t new Timer(); //タイマーオブジェクトの生成 t.Tick + new EventHandler(play); //タイマにメソッドを指定する t.Interval 20; //タイマ間隔を指定 t.Start(); //タイマを起動 } //起動処理 static void Main() { mostsimple ms new mostsimple(); //自オブジェクトを生成 ms.StartPosition FormStartPosition.Manual; //表示位置の調整を可能にする ms.Location new Point(0, 0); //フォーム左上端の位置を指定 ms.Size new Size(660, 520); //幅(640->660)と高さ(480->520)を指定 ms.Text "Game"; //タイトルを設定 ms.ControlBox false; ms.FormBorderStyle FormBorderStyle.Fixed3D; Application.Run(ms); //自オブジェクトへの参照をRunに与えることで開く }}/pre>p>補足:サウンド/p>pre>・C#のサウンド処理手法は複数提供されており、用途や特性に使い分けると良い・もっとも単純なのがSystem.Media.SoundPlayerを利用する手法・音声ファイルの読み込み System.Media.SoundPlayer 参照変数 new System.Media.SoundPlayer(ファイル名);・音声ファイルの再生(一回) 参照変数.Play();・音声ファイルのくり返し再生 参照変数.PlayLooping();・音声ファイルの再生の終了 参照変数.Stop();※ BGMと効果音の音声ファイルは下記を利用可能 https://rundog.org/si/briefing.wav 開始BGM https://rundog.org/si/stageA.wav プレイBGM https://rundog.org/si/Extra.wav ゲームオーバーBGM https://rundog.org/si/missile.wav 効果音/pre>p>参考:今回使用した素材について/p>pre>・ガルル研ライブラリが公開したフリー素材を用いています http://www.garuru.co.jp/top/lib/index.php/pre>p>以上です。/p> /div>!-- .entry-content --> footer classentry-footer> span classcat-links>カテゴリー: a hrefhttps://ha205.rundog.org/?cat5 relcategory>講師より/a>/span>span classcomments-link>ディスカッション:a hrefhttps://ha205.rundog.org/?p2010#respond classcomments-link >コメントを残す/a>/span> /footer>!-- .entry-footer -->/article>!-- #post-## -->article classpost-1989 post type-post status-publish format-standard hentry category-5> header classentry-header> h2 classentry-title>a hrefhttps://ha205.rundog.org/?p1989 relbookmark>講義メモ/a>/h2> div classentry-meta> span classposted-on>投稿日: a hrefhttps://ha205.rundog.org/?p1989 relbookmark>time classentry-date published datetime2021-09-11T11:04:17+09:00>2021年9月11日/time>time classupdated datetime2021-09-11T12:51:29+09:00>2021年9月11日/time>/a>/span>span classbyline> 投稿者: span classauthor vcard>a classurl fn n hrefhttps://ha205.rundog.org/?author1>maurundog/a>/span>/span> /div>!-- .entry-meta --> /header>!-- .entry-header --> div classentry-content> p>前半:p.409「データの並べ替えと個数」からbr />後半:ゲーム開発演習:自機の被弾によるゲームオーバーなど/p>p>p.409 データの並べ替えと個数/p>pre>・SQLの強みとして整列(ソート)のしやすさやグルーピングなどがある・昇順整列については、Linqで「orderby 項目名」でそのまま実装されている・降順整列にするには「orderby 項目名 descending」とすれば良い・また、クエリ結果に含まれるデータ件数を返すメソッドとして、Count()が提供されている/pre>p>p.409 linq02.cs 解説/p>pre>// p.409 linq02.cs 解説using System;using System.Collections.Generic; //IEnumerable<T>用using System.Linq; //内部的にIQueryable<T>用class linq02 { public static void Main() { string myStr {"flower", "cat", "dog", "bird", "rabbit"}; // クエリの作成(4文字以上を抽出し降順にソート) IEnumerable<string> q from s in myStr where s.Length > 4font colorblue> orderby s descending/font> select s; // クエリの実行 foreach (string x in q) Console.WriteLine(x); // 検索条件に適合した要素の個数font colorblue> Console.WriteLine("適合した数{0}", q.Count());/font> }}/pre>p>p.410 var型の利用/p>pre>・Linqのクエリ結果のオブジェクトの型は暗黙の型指定を用いると良い/pre>p>p.410 Listコレクションからのデータ抽出/p>pre>・配列と同様に、Listコレクション(p.367)のクエリをLinqで記述できる/pre>p>p.411 linq03.cs 解説/p>pre>// p.411 linq03.cs 解説using System;using System.Collections.Generic; //IEnumerable<T>、List<T>用using System.Linq; //内部的にIQueryable<T>用class data { public string name; public string address; public int age;}class linq03 { public static void Main() { List<data> mydata new List<data> { //オブジェクト初期化子を利用 new data {name "田中和夫", address "東京都", age 24}, new data {name "鈴木義男", address "東京都", age 17}, new data {name "吉田育子", address "青森県", age 24}, new data {name "田中和夫", address "東京都", age 34}, new data {name "小林一郎", address "北海道", age 29} }; // 旧式のデータ追加 data datax new data(); datax.name "粂井康孝"; datax.address "北海道"; datax.age 22; mydata.Add(datax); // 新方式のデータ追加(オブジェクト初期化子を利用) mydata.Add( new data {name "猫山太郎", address "青森県", age 15} );font colorblue> var q from x in mydata where x.age < 30 orderby x.age ascending select x; //Listに対するクエリ(暗黙の型指定を利用)/font> Console.WriteLine("氏名\t\t住所\t年齢"); foreach (data z in q) Console.WriteLine("{0}\t{1}\t{2}", z.name, z.address, z.age); }}/pre>p>p.413 メソッド構文の利用/p>pre>・Linqのクエリの構文として、よりC#らしい記述になるのがメソッド構文・where、orderby、selectを、メソッド風にWhere()、OrderBy()、Select()と記述できる・「orderby ● descending」は、メソッド風にOrderByDescending()と記述できる・それぞれのカッコ内(見かけ上の引数)には、詳細を記述したメソッドの名前を記述する・「using System.Collections.Generic;」は不要になる(using System.Linq;は必要)/pre>p>p.413 linq04.cs 解説/p>pre>// p.413 linq04.cs 解説using System;using System.Linq;class linq04 {font colorblue> static bool MyWhere(int x) { return (x > 0); } //Where用の条件式 static int MyOrderBy(int x) { return x; } //OrderBy用の何もしない式 static int MySelect(int x) { return x; } //Select用の何もしない式/font> public static void Main() { int numbers new int { 200, -3, 4, 1, 2, -6, 3, 100, -25 };font colorblue> //メソッド構文(条件で抽出した結果を降順に整列) var q numbers.Where(MyWhere) .OrderByDescending(MyOrderBy) .Select(MySelect);/font> //クエリの実行 foreach (int x in q) Console.WriteLine(x); }}/pre>p>p.415 メソッド構文の利用(匿名メソッド)/p>pre>・メソッド構文は冗長になるので、匿名メソッド(p.304)とすると良い・すると、メソッドの定義を排してdelegateでLinqの中に記述できる例:var q x.Where(delegate(int x){return x > 0;}).Select(delegate(int x){return x;});/pre>p>p.415 linq05.cs 解説/p>pre>// p.415 linq05.cs 解説using System;using System.Linq; //内部的にLinq用class linq05 { public static void Main() { int numbers new int {200, -3, 4, 1, 2, -6, 3, 100, -25};font colorblue> //メソッド構文(匿名メソッド) var q numbers.Where(delegate(int x) { return x > 0; }) .OrderByDescending(delegate (int x) { return x; }) .Select(delegate (int x) { return x; });/font> //クエリの実行 foreach (int x in q) Console.WriteLine(x); }}/pre>p>p.415 メソッド構文の利用(ラムダ式)/p>pre>・匿名メソッドを用いたメソッド構文は、ラムダ式にするとより見やすい 例:var q x.Where(x > x > 0).Select(x > x);/pre>p>p.415 linq06.cs 解説/p>pre>// p.415 linq06.cs 解説using System;using System.Linq; //内部的にLinq用class linq06 { public static void Main() { int numbers new int {200, -3, 4, 1, 2, -6, 3, 100, -25};font colorblue> //メソッド構文(ラムダ式) var q numbers.Where(x > x > 0) .OrderByDescending(x > x) .Select(x > x);/font> //クエリの実行 foreach (int x in q) Console.WriteLine(x); }}/pre>p>演習17-1 メソッド構文の利用(ラムダ式)/p>pre>・p.411 linq03.csをメソッド構文(ラムダ式)を用いて改良しよう/pre>p>作成例/p>pre>//演習17-1 メソッド構文の利用(ラムダ式)using System;using System.Collections.Generic; //IEnumerable<T>、List<T>用using System.Linq; //内部的にIQueryable<T>用class data { public string name; public string address; public int age;}class linq03 { public static void Main() { List<data> mydata new List<data> { //オブジェクト初期化子を利用 new data {name "田中和夫", address "東京都", age 24}, new data {name "鈴木義男", address "東京都", age 17}, new data {name "吉田育子", address "青森県", age 24}, new data {name "田中和夫", address "東京都", age 34}, new data {name "小林一郎", address "北海道", age 29} };font colorblue> var q mydata.Where(x > x.age < 30) .OrderBy(x > x.age) .Select(x > x); //Listに対するクエリ(ラムダ式を利用)/font> Console.WriteLine("氏名\t\t住所\t年齢"); foreach (data z in q) Console.WriteLine("{0}\t{1}\t{2}", z.name, z.address, z.age); }}/pre>p>p.416 XMLデータとLINQ/p>pre>・XDocumentクラスまたはXElementクラスを利用すると、XMLファイルからデータソースを得られる・利用には、using System.Xml.Linq を指定すると良い・XElementクラスの静的メソッドLoad(XMLファイル名)で、XElementクラス型のオブジェクトが得られる・これをLinqの対象としてクエリを行うことができる・Element(項目名)メソッドで要素への参照を得て、Valueプロパティでその値を得る ※ Valueで得た値は必要に応じてParseすること・上記は、foreachによる値の読み出しにおいても行う必要がある/pre>p>p.416 XMLデータとLINQ/p>pre>・XDocumentクラスまたはXElementクラスを利用すると、XMLファイルからデータソースを得られる・利用には、using System.Xml.Linq を指定すると良い・XElementクラスの静的メソッドLoad(XMLファイル名)で、XElementクラス型のオブジェクトが得られる・これをLinqの対象としてクエリを行うことができる・Elements()メソッドで全要素への参照を得て、fromのinに用いる・Element(項目名)メソッドで要素への参照を得て、Valueプロパティでその値を得る ※ Valueで得た値は必要に応じてParseすること・上記は、foreachによる値の読み出しにおいても行う必要がある例:XElement xo XElement.Load("XMLファイル名");var q from x in xo.Elements() where x.Element("項目名") ! null select x;foreach (var w in q) Console.Write(w.Element("項目名").Value);・System.Xml.LinqをVisual Studio 2019で用いるには: ①プロジェクトの「参照」を右クリックし「参照の追加」 ②「アセンブリ」の「System.Xml」と「System.Xml.Linq」をダブルクリックし「OK」 ③プロジェクトの「参照」を開いて②が追加されていれば良い/pre>p>p.416 student.xml/p>pre>・ソリューションに「追加」「新しい項目」で「XMLファイル」を選択し、名前を「student.xml」として「追加」・下記を流し込んで「保存」<?xml version"1.0" encoding"utf-8" ?><data> <student> <name>山田太郎</name> <id>100</id> <point>56</point> </student> <student> <name>上野義男</name> <id>101</id> <point>80</point> </student> <student> <name>岡田一郎</name> <id>102</id> <point>70</point> </student> <student> <name>吉田和夫</name> <id>103</id> <point>95</point> </student></data>/pre>p>【正誤】p.417 xml01.cs 016行目/p>pre> 【誤】orderby person.Element(point).Value descending 【正】orderby int.Parse(person.Element(point).Value) descending/pre>p>p.417 xml01.cs 解説/p>pre>// p.417 xml01.cs 解説using System;using System.Linq; //内部的にLinq用using System.Xml.Linq; //XElement用class xml01 { public static void Main() {font colorblue> //XMLファイルを読み込んでXElementクラス型のオブジェクトを得る XElement students XElement.Load("student.xml"); var q //XElementオブジェクトに対するクエリ from person in students.Elements() where int.Parse(person.Element("point").Value) > 60 orderby int.Parse(person.Element("point").Value) descending select person; foreach (var p in q) { //クエリ結果から要素ごとに値を得て表示 Console.WriteLine("{0}, {1}, {2}", p.Element("name").Value, p.Element("point").Value, p.Element("id").Value); }/font> }}/pre>p>p.419 XMLデータとLINQ(ラムダ式)/p>pre>・この場合も、ラムダ式を用いると見やすくなる/pre>p>p.419 xml02.cs 解説/p>pre>// p.419 xml02.cs 解説using System;using System.Linq; //内部的にLinq用using System.Xml.Linq; //XElement用class xml02 { public static void Main() { //XMLファイルを読み込んでXElementクラス型のオブジェクトを得る XElement Students XElement.Load("student.xml");font colorblue> var q //XElementオブジェクトに対するクエリ(ラムダ式) Students.Elements() .Where( x > int.Parse(x.Element("point").Value) > 60) .OrderByDescending( x > int.Parse(x.Element("point").Value)) .Select(x > x);/font> foreach (var p in q) { //クエリ結果から要素ごとに値を得て表示 Console.WriteLine("{0}, {1}, {2}", p.Element("name").Value, p.Element("point").Value, p.Element("id").Value); } }}/pre>p>テキストは以上です。/p> /div>!-- .entry-content --> footer classentry-footer> span classcat-links>カテゴリー: a hrefhttps://ha205.rundog.org/?cat5 relcategory>講師より/a>/span>span classcomments-link>ディスカッション:a hrefhttps://ha205.rundog.org/?p1989#respond classcomments-link >コメントを残す/a>/span> /footer>!-- .entry-footer -->/article>!-- #post-## -->article classpost-1976 post type-post status-publish format-standard hentry category-5> header classentry-header> h2 classentry-title>a hrefhttps://ha205.rundog.org/?p1976 relbookmark>今週の話題/a>/h2> div classentry-meta> span classposted-on>投稿日: a hrefhttps://ha205.rundog.org/?p1976 relbookmark>time classentry-date published datetime2021-09-11T10:34:31+09:00>2021年9月11日/time>time classupdated datetime2021-09-11T10:58:31+09:00>2021年9月11日/time>/a>/span>span classbyline> 投稿者: span classauthor vcard>a classurl fn n hrefhttps://ha205.rundog.org/?author1>maurundog/a>/span>/span> /div>!-- .entry-meta --> /header>!-- .entry-header --> div classentry-content> p>販売本数ランキング 今週首位はまさかの「リングフィット アドベンチャー」a hrefhttps://rundog.org/bbs/link.cgi?rhttps://www.famitsu.com/ranking/game-sales/ targettop relnoopener noreferrer>GO!/a>br />「Slack」がゲーム業界の新たなスタンダードツールに―多くの企業がSlackを導入する理由とメリットとは? a hrefhttps://rundog.org/bbs/link.cgi?rhttps://www.gamebusiness.jp/article/2021/09/08/19037.html targettop relnoopener noreferrer>GO!/a>br />Steam Deckは発売時から全てのゲームをサポートできるわけではない―ただしタイトルは増加する見込み a hrefhttps://rundog.org/bbs/link.cgi?rhttps://www.gamebusiness.jp/article/2021/09/09/19042.html targettop relnoopener noreferrer>GO!/a>br />SIEが『The Persistence』のFiresprite社を買収へ―独占タイトルを強化 a hrefhttps://rundog.org/bbs/link.cgi?rhttps://www.gamebusiness.jp/article/2021/09/09/19041.html targettop relnoopener noreferrer>GO!/a>br />PS4版『Horizon Forbidden West』PS5版への無料アップグレード提供へ―SIEタイトル今後の方針も明らかに a hrefhttps://rundog.org/bbs/link.cgi?rhttps://www.gamebusiness.jp/article/2021/09/06/19028.html targettop relnoopener noreferrer>GO!/a>/p>p>DMCA申請で削除された大型Mod「GTA: Underground」開発中止を発表―Modコミュニティに対する敵意が高まりつつあるため a hrefhttps://rundog.org/bbs/link.cgi?rhttps://www.gamebusiness.jp/article/2021/09/08/19039.html targettop relnoopener noreferrer>GO!/a>br />中国が「未成年者に対するネットゲーム規制」で業界の取締強化との報道―テンセントなど中国ゲーム企業の株は下落傾向 a hrefhttps://rundog.org/bbs/link.cgi?rhttps://www.gamebusiness.jp/article/2021/09/10/19045.html targettop relnoopener noreferrer>GO!/a>br />リメイク版『月姫』動画・生放送は“ネタバレ防止期間後も”公開禁止!9月9日以降はSNSにも注意 a hrefhttps://rundog.org/bbs/link.cgi?rhttps://www.gamebusiness.jp/article/2021/09/07/19031.html targettop relnoopener noreferrer>GO!/a>br />クラウド型の住基システムで一時障害 142市町村で住民票発行できず 現在は復旧 a hrefhttps://rundog.org/bbs/link.cgi?rhttps://www.itmedia.co.jp/news/articles/2109/09/news166.html targettop relnoopener noreferrer>GO!/a>/p> /div>!-- .entry-content --> footer classentry-footer> span classcat-links>カテゴリー: a hrefhttps://ha205.rundog.org/?cat5 relcategory>講師より/a>/span>span classcomments-link>ディスカッション:a hrefhttps://ha205.rundog.org/?p1976#respond classcomments-link >コメントを残す/a>/span> /footer>!-- .entry-footer -->/article>!-- #post-## -->article classpost-1974 post type-post status-publish format-standard hentry category-5> header classentry-header> h2 classentry-title>a hrefhttps://ha205.rundog.org/?p1974 relbookmark>前回のコメントです/a>/h2> div classentry-meta> span classposted-on>投稿日: a hrefhttps://ha205.rundog.org/?p1974 relbookmark>time classentry-date published datetime2021-09-11T09:40:59+09:00>2021年9月11日/time>time classupdated datetime2021-09-11T09:41:25+09:00>2021年9月11日/time>/a>/span>span classbyline> 投稿者: span classauthor vcard>a classurl fn n hrefhttps://ha205.rundog.org/?author1>maurundog/a>/span>/span> /div>!-- .entry-meta --> /header>!-- .entry-header --> div classentry-content> p>・自作の属性を作成してみました。br /> プロジェクト名:20210904CharpProjectbr /> ファイル名:MyTestAttribute.csbr /> 自作の属性の利用する場面など思いつかなかったので今後いろいろ試行錯誤してみてbr /> 自作の属性を活用できるようにしていきたいと思います。/p>p> font colordarkred>拝見しました。いいですね。br /> 下記のC#オフィシャルドキュメントによると、AttributeUsage の指定が推奨?されているようですので、br /> 実務では記述が求められるかもしれません。br /> https://docs.microsoft.com/ja-jp/dotnet/standard/attributes/writing-custom-attributesbr /> あと、Linqのクエリが混じってましたので、何か関連があるのかと思いましたが、とくにつながってないのですね?/font>/p> /div>!-- .entry-content --> footer classentry-footer> span classcat-links>カテゴリー: a hrefhttps://ha205.rundog.org/?cat5 relcategory>講師より/a>/span>span classcomments-link>ディスカッション:a hrefhttps://ha205.rundog.org/?p1974#respond classcomments-link >コメントを残す/a>/span> /footer>!-- .entry-footer -->/article>!-- #post-## -->article classpost-1969 post type-post status-publish format-standard hentry category-5> header classentry-header> h2 classentry-title>a hrefhttps://ha205.rundog.org/?p1969 relbookmark>次回予告と今回の講義メモ/a>/h2> div classentry-meta> span classposted-on>投稿日: a hrefhttps://ha205.rundog.org/?p1969 relbookmark>time classentry-date published updated datetime2021-09-04T13:35:46+09:00>2021年9月4日/time>/a>/span>span classbyline> 投稿者: span classauthor vcard>a classurl fn n hrefhttps://ha205.rundog.org/?author1>maurundog/a>/span>/span> /div>!-- .entry-meta --> /header>!-- .entry-header --> div classentry-content> p>次回、最終回br />前半:p.409「データの並べ替えと個数」からbr />後半:ゲーム開発演習:自機の被弾によるゲームオーバーなどbr />講義メモ:a hrefhttps://ha205.rundog.org/wp-content/uploads/2021/09/講義メモ20210904.zip>講義メモ20210904.zip/a>/p> /div>!-- .entry-content --> footer classentry-footer> span classcat-links>カテゴリー: a hrefhttps://ha205.rundog.org/?cat5 relcategory>講師より/a>/span>span classcomments-link>ディスカッション:a hrefhttps://ha205.rundog.org/?p1969#respond classcomments-link >コメントを残す/a>/span> /footer>!-- .entry-footer -->/article>!-- #post-## -->article classpost-1956 post type-post status-publish format-standard hentry category-5> header classentry-header> h2 classentry-title>a hrefhttps://ha205.rundog.org/?p1956 relbookmark>講義メモ 後半:ゲーム開発演習/a>/h2> div classentry-meta> span classposted-on>投稿日: a hrefhttps://ha205.rundog.org/?p1956 relbookmark>time classentry-date published datetime2021-09-04T12:46:31+09:00>2021年9月4日/time>time classupdated datetime2021-09-04T13:33:38+09:00>2021年9月4日/time>/a>/span>span classbyline> 投稿者: span classauthor vcard>a classurl fn n hrefhttps://ha205.rundog.org/?author1>maurundog/a>/span>/span> /div>!-- .entry-meta --> /header>!-- .entry-header --> div classentry-content> p>全砲台から発射、開始画面(フォント文字列の表示)、ゲームモード/p>p>演習33 敵弾の全砲台からの発射/p>pre>・敵弾がすべての砲台から発射され、自機に向かって移動するようにしよう・敵弾数を8とする・敵砲台ごとに冷却タイマ(発射時に10)を設定し、タイマによってデクリメントする・砲台が画面範囲(中心がY0から400まで)にある時に、冷却タイマが0であれば、 未出現の敵弾を探し、あれば、砲台の中心位置を初期座標として出現させる/pre>p>作成例/p>pre>//演習33 敵弾の複数発射using System; //EventArgsクラス用using System.Windows.Forms; //Formクラス用using System.Drawing; //Point,Size,Imageクラス用//構造体struct infos { //画面上の物体の情報を持つ構造体 int x, y; //XY座標 Image i; //画像への参照 int sx; //X速度 int sy; //y速度 double sr; //移動角度 bool ex; //有無 public int X { get { return x; } set { x value; } } //プロパティ public int Y { get { return y; } set { y value; } } //〃 public int SX { get { return sx; } set { sx value; } } //〃 public int SY { get { return sy; } set { sy value; } } //〃 public bool EX { get { return ex; } set { ex value; } } //〃 public double SR { get { return sr; } set { sr value; } } //〃 public Image I { get { return i; } set { i value; } } //〃 public int MX { get { return x + i.Width / 2; } } //中心X座標を返す〃 public int MY { get { return y + i.Height / 2; } } //中心Y座標を返す〃 public double IL { get { //内径(幅と高さの小さい方の半分)を返す〃 return (i.Width < i.Height) ? i.Width / 2.0 : i.Height / 2.0; } } public infos(int x, int y, Image i) { //コンストラクタ(自機) this.x x; this.y y; this.i i; sx 0; sy 0; sr 0; this.ex true; } public infos(int x, int y, Image i, bool ex) { //コンストラクタ(自弾、敵弾) this.x x; this.y y; this.i i; sx 0; sy -10; sr 0; this.ex ex; }}//クラス定義class mostsimple : Form { //Formを継承すること System.Runtime.InteropServices.DllImport("user32.dll") private static extern short GetKeyState(int nVirtKey); //外部定義指定 Image back0 Image.FromFile("backb2.bmp"); //背景画像①ファイルを得る Image back1 Image.FromFile("backb2.bmp"); //背景画像②ファイルを得る static Image plin Image.FromFile("player.gif"); //自機画像(通常)ファイルを得る static Image plil Image.FromFile("playerl.gif"); //自機画像(左寄)ファイルを得る static Image plir Image.FromFile("playerr.gif"); //自機画像(右寄)ファイルを得る infos P new infos(300, 395, plin); //自機の情報を生成 const int xspeed 10; //左右移動速度 int yspeed 1; //縦スクロール速度 int backc 0; //背景画像のつなぎ目のY座標 const int pbnum 8; //自弾の最大数 int pbcd 0; //自弾の冷却タイマ const int pbcdn 5; //自弾の冷却タイマ数 infos PBA new infospbnum; //自弾の配列 static Image ecnin Image.FromFile("enemy.gif"); //敵砲台画像ファイルを得る const int ecnum 4; //敵砲台数 infos ECA new infosecnum; //敵砲台の配列font colorblue> int eccd new intecnum; //【追加】敵砲台の冷却タイマ const int eccdn 10; //【追加】敵砲台の冷却タイマ数 //static Image ebimg Image.FromFile("ebullet.gif"); //【削除】敵弾画像ファイルを得る const int ebnum 8; //【追加】敵弾の最大数 infos EBA new infosebnum; //【追加】敵弾の配列/font> //共通部品(衝突判定用) private bool isHit(infos a, infos b) { //中心距離を用いた衝突判定 return Math.Pow(a.MX - b.MX, 2) + Math.Pow(a.MY - b.MY, 2) < Math.Pow(a.IL + b.IL, 2); } //共通部品(オブジェクトを指定方向へ45度単位で回転させる) private Point getPoints(infos i, int x, int y) { //オブジェクトiを座標(x,y)方向へ回転するための座標配列を返す int x0, y0, x1, y1, x2, y2; //左上、右上、左下の座標 x0 x1 x2 i.X; //仮にオブジェクトiの左上座標としておく y0 y1 y2 i.Y; //〃 double r Math.Atan2(y - i.MY, x - i.MX); //座標xyとの中心座標角度(ラジアン)を得る double d (Math.Sqrt(2.0) - 1.0) / 2.0; //斜めにした場合にはみ出す部分の割合 if (r > -Math.PI * 7 / 8 && r < -Math.PI * 5 / 8) { //左上 x0 - (int)(i.I.Width * d); y0 + i.I.Height / 2; x1 + i.I.Width / 2; y1 - (int)(i.I.Height * d); x2 x1; y2 + (int)(i.I.Height * (1 + d)); } else if (r > -Math.PI * 5 / 8 && r < -Math.PI * 3 / 8) { //上 x1 + i.I.Width; y2 + i.I.Height; } else if (r > -Math.PI * 3 / 8 && r < -Math.PI * 1 / 8) { //右上 x0 + i.I.Width / 2; y0 - (int)(i.I.Height * 0.2); x1 + (int)(i.I.Width * (1 + d)); y1 + i.I.Height / 2; x2 - (int)(i.I.Width * d); y2 y1; } else if (r > -Math.PI * 1 / 8 && r < Math.PI * 1 / 8) { //右 x0 + i.I.Width; x1 x0; y1 + i.I.Height; } else if (r > Math.PI * 1 / 8 && r < Math.PI * 3 / 8) { //右下 x0 + (int)(i.I.Width * (1 + d)); y0 + i.I.Height / 2; x1 + i.I.Width / 2; y1 + (int)(i.I.Height * (1 + d)); x2 x1; y2 - (int)(i.I.Height * d); } else if (r > Math.PI * 3 / 8 && r < Math.PI * 5 / 8) { //下 x0 + i.I.Width; y0 + i.I.Height; y1 y0; x2 x0; } else if (r > Math.PI * 5 / 8 && r < Math.PI * 7 / 8) { //左下 x0 + i.I.Width / 2; y0 + (int)(i.I.Height * 1.2); x1 - (int)(i.I.Width * d); y1 + i.I.Height / 2; x2 + (int)(i.I.Width * (1 + d)); y2 y1; } else { //左 y0 + i.I.Height; x2 + i.I.Width; y2 y0; } Point pts {new Point(x0, y0), new Point(x1, y1), new Point(x2, y2)}; return pts; } //描画処理(主処理などからシステム経由で呼び出される) protected override void OnPaint(PaintEventArgs e) { //描画処理のオーバーライド base.OnPaint(e); //冒頭で基本クラスのメソッド内容を実行 if (backc ! 0) e.Graphics.DrawImage(back0, 0, backc - back0.Height); //背景画像①を描画 if (backc ! back1.Height) e.Graphics.DrawImage(back1, 0, backc); //背景画像②を描画 for (int i 0; i < pbnum; i++) { //全自弾分繰返す if (PBAi.EX) e.Graphics.DrawImage(PBAi.I, PBAi.X, PBAi.Y); //自弾画像を描画 }font colorblue> for (int i 0; i < ebnum; i++) { //【以下追加】全敵弾分繰返す if (EBAi.EX) e.Graphics.DrawImage(EBAi.I, EBAi.X, EBAi.Y); //【変更】敵弾画像を描画 }/font> for (int i 0; i < ecnum; i++) { //全敵砲台分繰返す if (ECAi.EX) e.Graphics.DrawImage(ECAi.I, getPoints(ECAi, P.MX, P.MY)); //自機に向くように描画 } e.Graphics.DrawImage(P.I, P.X, P.Y); //自機画像を描画 } //主処理(タイマーに呼び出される) private void play(object o, EventArgs ea){ //キー入力 if (GetKeyState((int)Keys.Escape) < 0) { //Escキーが押されている this.Close(); //終了 } P.I plin; //自機画像(通常)を用いる if (GetKeyState((int)Keys.Left) < 0) { //←キーが押されている P.I plil; //自機画像(左寄)を用いる if(P.SX > -xspeed) P.SX - 2; //左移動の速度を設定 } else if (GetKeyState((int)Keys.Right) < 0) { //→キーが押されている P.I plir; //自機画像(右寄)を用いる if(P.SX < xspeed) P.SX + 2; //右移動の速度を設定 } if (GetKeyState((int)Keys.Up) < 0) { //↑キーが押されている if(P.SY > -yspeed) P.SY - 5; //上移動の速度を設定 } else if (GetKeyState((int)Keys.Down) < 0) { //↓キーが押されている if(P.SY < yspeed) P.SY + 5; //下移動の速度を設定 } if (GetKeyState((int)Keys.Space) < 0) { //スペースキーが押されている if (pbcd < 0) { //冷却完了? int i 0; //発射可能な自弾の添字 for (; i < pbnum; i++) { //全自弾分繰返す if(!PBAi.EX) break; //自弾iが発射可能なら繰返し終了 } if (i < pbnum) { //発射可能な自弾があれば PBAi.X P.X + P.I.Width / 2 - PBAi.I.Width / 2; //X座標は自機の中央 PBAi.Y P.Y - PBAi.I.Height; //Y座標は自機の直上 PBAi.EX true; //自弾i有 } pbcd pbcdn; //冷却タイマをセット } else { //冷却中? pbcd--; //冷却タイマカウントダウン } } //自機の移動 if (P.SX < 0) { //左へ移動中? P.X + P.SX; //左へ移動 if (P.X < 0) { //左端を超えたら P.X 0; //左端に固定 P.SX 0; //移動停止 } else { P.SX++; //減速 } } else if (P.SX > 0) { //右へ移動中? P.X + P.SX; //右へ移動 if (P.X > back0.Width - P.I.Width) { //右端を超えたら P.X back0.Width - P.I.Width; //右端に固定 P.SX 0; //移動停止 } else { P.SX--; //減速 } } if (P.SY < 0) { //上へ移動中? P.Y + P.SY; //上へ移動 if (P.Y < 0) { //上端を超えたら P.Y 0; //上端に固定 P.SY 0; //移動停止 } else { P.SY++; //減速 } } else if (P.SY > 0) { //下へ移動中? P.Y + P.SY; //下へ移動 if (P.Y > back0.Height - P.I.Height) { //下端を超えたら P.Y back0.Height - P.I.Height; //下端に固定 P.SY 0; //移動停止 } else { P.SY--; //減速 } } //自弾の移動と衝突判定 for (int i 0; i < pbnum; i++) { //全自弾分繰返す if (PBAi.EX) { //自弾iがあれば PBAi.Y + PBAi.SY; //上へ移動 if (PBAi.Y < -PBAi.I.Height) { //上端を超えたら PBAi.EX false; //自弾iを消す } else { for (int j 0; j < ecnum; j++) { //全敵砲台分繰返す if (ECAj.EX && isHit(PBAi, ECAj)) { //自弾iと敵砲台jが衝突? PBAi.EX false; //自弾iを消す ECAj.EX false; //敵砲台jを消す } } } } } //敵弾の移動font colorblue> for (int i 0; i < ebnum; i++) { //【追加】全敵弾分繰返す if (EBAi.EX){ //【以下変更】敵弾があれば EBAi.X EBAi.X + (int)(Math.Cos(EBAi.SR) * 10); //角度から移動先X座標を得る EBAi.Y EBAi.Y + (int)(Math.Sin(EBAi.SR) * 10); //角度から移動先Y座標を得る if (EBAi.MX < 0 || EBAi.MX > 640 || EBAi.MY < 0 || EBAi.MY > 480) EBAi.EX false; //出たら消す } }/font> //敵砲台の移動と敵弾の出現 for (int i 0; i < ecnum; i++) { //全敵砲台分繰返すfont colorblue> if (ECAi.EX && ECAi.MY > 0 && ECAi.MY < 400) { //【変更】敵砲台iが範囲内に出現中? if (eccdi < 0) { //【以下追加&変更】冷却完了? int j 0; //発射可能な敵弾の添字 for (; j < ebnum; j++) { //全敵弾分繰返す if(!EBAj.EX) break; //敵弾jが発射可能なら繰返し終了 } if (j < ebnum) { //発射可能な敵弾があれば EBAj.X ECAi.MX - EBAj.I.Width / 2; //敵砲台iの中央 EBAj.Y ECAi.MY - EBAj.I.Height / 2; //〃 EBAj.SR Math.Atan2(P.MY - EBAj.MY, P.MX - EBAj.MX); //座標xyとの中心座標角度(ラジアン)を得る EBAj.EX true; //敵弾出現 } eccdi eccdn; //冷却タイマをセット } else { //冷却中? eccdi--; //冷却タイマカウントダウン } }/font> if (ECAi.Y < back0.Height * 2 - ecnin.Height) { //敵砲台が下端に達するまで ECAi.Y + yspeed; //下方に移動 } else { //下端に達したら ECAi.Y -ecnin.Height; //上方から出現 ECAi.EX true; //敵砲台iを再出現 } } //背景の移動 backc (backc < back0.Height) ? backc + yspeed : 0; //背景画像のつなぎ目を下げる Invalidate(); //画面に反映 } //コンストラクタ mostsimple() { SetStyle(ControlStyles.DoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true); //ダブルバッファリングを設定 for (int i 0; i < pbnum; i++) { //全自弾分繰返す PBAi new infos(0, 0, Image.FromFile("bullet.gif"), false); //自弾の情報を生成 } ECA0 new infos(115, 440, Image.FromFile("enemy.gif"), true); //敵砲台生成(仮) ECA1 new infos(462, 440, ECA0.I, true); //〃 ECA2 new infos(115, 920, ECA0.I, true); //〃 ECA3 new infos(462, 920, ECA0.I, true); //〃font colorblue> for (int i 0; i < ebnum; i++) { //【以下追加】全敵弾分繰返す EBAi new infos(0, 0, Image.FromFile("ebullet.gif"), false); //敵弾の情報を生成 }/font> Timer t new Timer(); //タイマーオブジェクトの生成 t.Tick + new EventHandler(play); //タイマにメソッドを指定する t.Interval 20; //タイマ間隔を指定 t.Start(); //タイマを起動 } //起動処理 static void Main() { mostsimple ms new mostsimple(); //自オブジェクトを生成 ms.StartPosition FormStartPosition.Manual; //表示位置の調整を可能にする ms.Location new Point(0, 0); //フォーム左上端の位置を指定 ms.Size new Size(660, 520); //幅(640->660)と高さ(480->520)を指定 ms.Text "Game"; //タイトルを設定 ms.ControlBox false; ms.FormBorderStyle FormBorderStyle.Fixed3D; Application.Run(ms); //自オブジェクトへの参照をRunに与えることで開く }}/pre>p>ゲーム開発演習(28) フォント文字列の表示/p>pre>・C#のGraphics.DrawStringメソッドを用いると、画面上に文字列を描画できる. このメソッドにはいくつかのオーバロードがあるが、ここでは下記のシグニチャを用いる。 Graphics.DrawString(文字列, フォント, ブラシ, X座標, Y座標);・フォントはFontクラスのインスタンスで、コンストラクタにはいくつかのオーバロードがあるが、ここでは下記のシグニチャを用いる。 Font 参照変数 new Font(フォントファミリ名, ポイント数, フォントスタイル);・フォントファミリ名として一般的に使えるのはArial、MS 明朝、メイリオ など。・ポイント数は整数で指定・フォントスタイルは、FontStyleクラスの静的メンバで、 Regular、Bold(太字)、Italic(斜体)、Underline(下線)、Strikeout(打消線)のどれかを指定。・ブラシは描画するテキストの色とテクスチャを決定するもので、Brushクラスのインスタンスを用いる。 ここではBrushを継承する単色のSolidBrushクラスを用いる。 SolidBrush 参照変数 new SolidBrush(色);・色はColorクラスの静的メンバで、White、Black、Red、Cyanなどが指定できる。 例: SolidBrush sb new SolidBrush(Color.Cyan); //テキストの塗りつぶし指定を生成 Font f new Font(メイリオ, 40, FontStyle.Bold); //フォント指定を生成 e.Graphics.DrawString(Hello, f, sb, 150, 190); //文字列「Hello」を描画/pre>p>ゲーム開発演習(29) ゲームモード/p>pre>・開始画面やゲームオーバー画面をプレイ画面と同様な動きを持たせて表示する場合・ゲームの状態を示す変数(例:int gamemode)を定義して、各処理においてこの値を参照すると良い・ゲーム状態の遷移によって、この値を変更する 例:開始時=0、ゲーム中=1、ゲームオーバー=9・ゲーム中でも特殊な状態(例:自機が被弾して無敵状態)も、同様で良い(同じ変数を用いるかどうかはケースバイケース)/pre>p>演習34 開始画面/p>pre>・起動時に適当な開始画面を表示し、Enterキーでプレイ画面に遷移しよう/pre>p>作成例/p>pre>//演習34 開始画面using System; //EventArgsクラス用using System.Windows.Forms; //Formクラス用using System.Drawing; //Point,Size,Imageクラス用//構造体struct infos { //画面上の物体の情報を持つ構造体 int x, y; //XY座標 Image i; //画像への参照 int sx; //X速度 int sy; //y速度 double sr; //移動角度 bool ex; //有無 public int X { get { return x; } set { x value; } } //プロパティ public int Y { get { return y; } set { y value; } } //〃 public int SX { get { return sx; } set { sx value; } } //〃 public int SY { get { return sy; } set { sy value; } } //〃 public bool EX { get { return ex; } set { ex value; } } //〃 public double SR { get { return sr; } set { sr value; } } //〃 public Image I { get { return i; } set { i value; } } //〃 public int MX { get { return x + i.Width / 2; } } //中心X座標を返す〃 public int MY { get { return y + i.Height / 2; } } //中心Y座標を返す〃 public double IL { get { //内径(幅と高さの小さい方の半分)を返す〃 return (i.Width < i.Height) ? i.Width / 2.0 : i.Height / 2.0; } } public infos(int x, int y, Image i) { //コンストラクタ(自機) this.x x; this.y y; this.i i; sx 0; sy 0; sr 0; this.ex true; } public infos(int x, int y, Image i, bool ex) { //コンストラクタ(自弾、敵弾) this.x x; this.y y; this.i i; sx 0; sy -10; sr 0; this.ex ex; }}//クラス定義class mostsimple : Form { //Formを継承すること System.Runtime.InteropServices.DllImport("user32.dll") private static extern short GetKeyState(int nVirtKey); //外部定義指定 Image back0 Image.FromFile("backb2.bmp"); //背景画像①ファイルを得る Image back1 Image.FromFile("backb2.bmp"); //背景画像②ファイルを得る static Image plin Image.FromFile("player.gif"); //自機画像(通常)ファイルを得る static Image plil Image.FromFile("playerl.gif"); //自機画像(左寄)ファイルを得る static Image plir Image.FromFile("playerr.gif"); //自機画像(右寄)ファイルを得る infos P new infos(300, 395, plin); //自機の情報を生成 const int xspeed 10; //左右移動速度 int yspeed 1; //縦スクロール速度 int backc 0; //背景画像のつなぎ目のY座標 const int pbnum 8; //自弾の最大数 int pbcd 0; //自弾の冷却タイマ const int pbcdn 5; //自弾の冷却タイマ数 infos PBA new infospbnum; //自弾の配列 static Image ecnin Image.FromFile("enemy.gif"); //敵砲台画像ファイルを得る const int ecnum 4; //敵砲台数 infos ECA new infosecnum; //敵砲台の配列 int eccd new intecnum; //敵砲台の冷却タイマ const int eccdn 10; //敵砲台の冷却タイマ数 const int ebnum 8; //敵弾の最大数 infos EBA new infosebnum; //敵弾の配列font colorblue> int gamemode 0; //【追加】ゲームモード(開始時:0,ゲーム中:1,ゲームオーバー:9)/font> //共通部品(衝突判定用) private bool isHit(infos a, infos b) { //中心距離を用いた衝突判定 return Math.Pow(a.MX - b.MX, 2) + Math.Pow(a.MY - b.MY, 2) < Math.Pow(a.IL + b.IL, 2); } //共通部品(オブジェクトを指定方向へ45度単位で回転させる) private Point getPoints(infos i, int x, int y) { //オブジェクトiを座標(x,y)方向へ回転するための座標配列を返す int x0, y0, x1, y1, x2, y2; //左上、右上、左下の座標 x0 x1 x2 i.X; //仮にオブジェクトiの左上座標としておく y0 y1 y2 i.Y; //〃 double r Math.Atan2(y - i.MY, x - i.MX); //座標xyとの中心座標角度(ラジアン)を得る double d (Math.Sqrt(2.0) - 1.0) / 2.0; //斜めにした場合にはみ出す部分の割合 if (r > -Math.PI * 7 / 8 && r < -Math.PI * 5 / 8) { //左上 x0 - (int)(i.I.Width * d); y0 + i.I.Height / 2; x1 + i.I.Width / 2; y1 - (int)(i.I.Height * d); x2 x1; y2 + (int)(i.I.Height * (1 + d)); } else if (r > -Math.PI * 5 / 8 && r < -Math.PI * 3 / 8) { //上 x1 + i.I.Width; y2 + i.I.Height; } else if (r > -Math.PI * 3 / 8 && r < -Math.PI * 1 / 8) { //右上 x0 + i.I.Width / 2; y0 - (int)(i.I.Height * 0.2); x1 + (int)(i.I.Width * (1 + d)); y1 + i.I.Height / 2; x2 - (int)(i.I.Width * d); y2 y1; } else if (r > -Math.PI * 1 / 8 && r < Math.PI * 1 / 8) { //右 x0 + i.I.Width; x1 x0; y1 + i.I.Height; } else if (r > Math.PI * 1 / 8 && r < Math.PI * 3 / 8) { //右下 x0 + (int)(i.I.Width * (1 + d)); y0 + i.I.Height / 2; x1 + i.I.Width / 2; y1 + (int)(i.I.Height * (1 + d)); x2 x1; y2 - (int)(i.I.Height * d); } else if (r > Math.PI * 3 / 8 && r < Math.PI * 5 / 8) { //下 x0 + i.I.Width; y0 + i.I.Height; y1 y0; x2 x0; } else if (r > Math.PI * 5 / 8 && r < Math.PI * 7 / 8) { //左下 x0 + i.I.Width / 2; y0 + (int)(i.I.Height * 1.2); x1 - (int)(i.I.Width * d); y1 + i.I.Height / 2; x2 + (int)(i.I.Width * (1 + d)); y2 y1; } else { //左 y0 + i.I.Height; x2 + i.I.Width; y2 y0; } Point pts {new Point(x0, y0), new Point(x1, y1), new Point(x2, y2)}; return pts; } //描画処理(主処理などからシステム経由で呼び出される) protected override void OnPaint(PaintEventArgs e) { //描画処理のオーバーライド base.OnPaint(e); //冒頭で基本クラスのメソッド内容を実行 if (backc ! 0) e.Graphics.DrawImage(back0, 0, backc - back0.Height); //背景画像①を描画 if (backc ! back1.Height) e.Graphics.DrawImage(back1, 0, backc); //背景画像②を描画font colorblue> if (gamemode 0) { //【以下追加】ゲームモードが開始? SolidBrush sb new SolidBrush(Color.Cyan); //テキストの塗りつぶし指定を生成 Font f new Font("メイリオ", 40, FontStyle.Bold); //フォント指定を生成 e.Graphics.DrawString("Zaviel", f, sb, 210, 190); //ゲーム名を描画 sb new SolidBrush(Color.Yellow); //テキストの塗りつぶし指定を生成 f new Font("メイリオ", 20, FontStyle.Bold); //フォント指定を生成 e.Graphics.DrawString("Hit Enter to Start !", f, sb, 180, 320); //メッセージを描画 } else { //【追加】ゲームモードがプレイ中以降?/font> for (int i 0; i < pbnum; i++) { //全自弾分繰返す if (PBAi.EX) e.Graphics.DrawImage(PBAi.I, PBAi.X, PBAi.Y); //自弾画像を描画 } for (int i 0; i < ebnum; i++) { //全敵弾分繰返す if (EBAi.EX) e.Graphics.DrawImage(EBAi.I, EBAi.X, EBAi.Y); //敵弾画像を描画 } for (int i 0; i < ecnum; i++) { //全敵砲台分繰返す if (ECAi.EX) e.Graphics.DrawImage(ECAi.I, getPoints(ECAi, P.MX, P.MY)); //自機に向くように描画 } e.Graphics.DrawImage(P.I, P.X, P.Y); //自機画像を描画 } } //主処理(タイマーに呼び出される) private void play(object o, EventArgs ea){ //キー入力 if (GetKeyState((int)Keys.Escape) < 0) { //Escキーが押されている this.Close(); //終了 }font colorblue> if (gamemode 0) { //【以下追加】ゲームモードが開始? if (GetKeyState((int)Keys.Enter) < 0) { //Enterキーが押されている gamemode 1; //ゲームモードをゲーム中に } } else { //【追加】/font> P.I plin; //自機画像(通常)を用いる if (GetKeyState((int)Keys.Left) < 0) { //←キーが押されている P.I plil; //自機画像(左寄)を用いる if(P.SX > -xspeed) P.SX - 2; //左移動の速度を設定 } else if (GetKeyState((int)Keys.Right) < 0) { //→キーが押されている P.I plir; //自機画像(右寄)を用いる if(P.SX < xspeed) P.SX + 2; //右移動の速度を設定 } if (GetKeyState((int)Keys.Up) < 0) { //↑キーが押されている if(P.SY > -yspeed) P.SY - 5; //上移動の速度を設定 } else if (GetKeyState((int)Keys.Down) < 0) { //↓キーが押されている if(P.SY < yspeed) P.SY + 5; //下移動の速度を設定 } if (GetKeyState((int)Keys.Space) < 0) { //スペースキーが押されている if (pbcd < 0) { //冷却完了? int i 0; //発射可能な自弾の添字 for (; i < pbnum; i++) { //全自弾分繰返す if(!PBAi.EX) break; //自弾iが発射可能なら繰返し終了 } if (i < pbnum) { //発射可能な自弾があれば PBAi.X P.X + P.I.Width / 2 - PBAi.I.Width / 2; //X座標は自機の中央 PBAi.Y P.Y - PBAi.I.Height; //Y座標は自機の直上 PBAi.EX true; //自弾i有 } pbcd pbcdn; //冷却タイマをセット } else { //冷却中? pbcd--; //冷却タイマカウントダウン } } //自機の移動 if (P.SX < 0) { //左へ移動中? P.X + P.SX; //左へ移動 if (P.X < 0) { //左端を超えたら P.X 0; //左端に固定 P.SX 0; //移動停止 } else { P.SX++; //減速 } } else if (P.SX > 0) { //右へ移動中? P.X + P.SX; //右へ移動 if (P.X > back0.Width - P.I.Width) { //右端を超えたら P.X back0.Width - P.I.Width; //右端に固定 P.SX 0; //移動停止 } else { P.SX--; //減速 } } if (P.SY < 0) { //上へ移動中? P.Y + P.SY; //上へ移動 if (P.Y < 0) { //上端を超えたら P.Y 0; //上端に固定 P.SY 0; //移動停止 } else { P.SY++; //減速 } } else if (P.SY > 0) { //下へ移動中? P.Y + P.SY; //下へ移動 if (P.Y > back0.Height - P.I.Height) { //下端を超えたら P.Y back0.Height - P.I.Height; //下端に固定 P.SY 0; //移動停止 } else { P.SY--; //減速 } } //自弾の移動と衝突判定 for (int i 0; i < pbnum; i++) { //全自弾分繰返す if (PBAi.EX) { //自弾iがあれば PBAi.Y + PBAi.SY; //上へ移動 if (PBAi.Y < -PBAi.I.Height) { //上端を超えたら PBAi.EX false; //自弾iを消す } else { for (int j 0; j < ecnum; j++) { //全敵砲台分繰返す if (ECAj.EX && isHit(PBAi, ECAj)) { //自弾iと敵砲台jが衝突? PBAi.EX false; //自弾iを消す ECAj.EX false; //敵砲台jを消す } } } } } //敵弾の移動 for (int i 0; i < ebnum; i++) { //全敵弾分繰返す if (EBAi.EX){ //敵弾があれば EBAi.X EBAi.X + (int)(Math.Cos(EBAi.SR) * 10); //角度から移動先X座標を得る EBAi.Y EBAi.Y + (int)(Math.Sin(EBAi.SR) * 10); //角度から移動先Y座標を得る if (EBAi.MX < 0 || EBAi.MX > 640 || EBAi.MY < 0 || EBAi.MY > 480) EBAi.EX false; //出たら消す } } //敵砲台の移動と敵弾の出現 for (int i 0; i < ecnum; i++) { //全敵砲台分繰返す if (ECAi.EX && ECAi.MY > 0 && ECAi.MY < 400) { //敵砲台iが範囲内に出現中? if (eccdi < 0) { //冷却完了? int j 0; //発射可能な敵弾の添字 for (; j < ebnum; j++) { //全敵弾分繰返す if(!EBAj.EX) break; //敵弾jが発射可能なら繰返し終了 } if (j < ebnum) { //発射可能な敵弾があれば EBAj.X ECAi.MX - EBAj.I.Width / 2; //敵砲台iの中央 EBAj.Y ECAi.MY - EBAj.I.Height / 2; //〃 EBAj.SR Math.Atan2(P.MY - EBAj.MY, P.MX - EBAj.MX); //座標xyとの中心座標角度(ラジアン)を得る EBAj.EX true; //敵弾出現 } eccdi eccdn; //冷却タイマをセット } else { //冷却中? eccdi--; //冷却タイマカウントダウン } } if (ECAi.Y < back0.Height * 2 - ecnin.Height) { //敵砲台が下端に達するまで ECAi.Y + yspeed; //下方に移動 } else { //下端に達したら ECAi.Y -ecnin.Height; //上方から出現 ECAi.EX true; //敵砲台iを再出現 } } } //背景の移動 backc (backc < back0.Height) ? backc + yspeed : 0; //背景画像のつなぎ目を下げる Invalidate(); //画面に反映 } //コンストラクタ mostsimple() { SetStyle(ControlStyles.DoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true); //ダブルバッファリングを設定 for (int i 0; i < pbnum; i++) { //全自弾分繰返す PBAi new infos(0, 0, Image.FromFile("bullet.gif"), false); //自弾の情報を生成 } ECA0 new infos(115, 440, Image.FromFile("enemy.gif"), true); //敵砲台生成(仮) ECA1 new infos(462, 440, ECA0.I, true); //〃 ECA2 new infos(115, 920, ECA0.I, true); //〃 ECA3 new infos(462, 920, ECA0.I, true); //〃 for (int i 0; i < ebnum; i++) { //全敵弾分繰返す EBAi new infos(0, 0, Image.FromFile("ebullet.gif"), false); //敵弾の情報を生成 } Timer t new Timer(); //タイマーオブジェクトの生成 t.Tick + new EventHandler(play); //タイマにメソッドを指定する t.Interval 20; //タイマ間隔を指定 t.Start(); //タイマを起動 } //起動処理 static void Main() { mostsimple ms new mostsimple(); //自オブジェクトを生成 ms.StartPosition FormStartPosition.Manual; //表示位置の調整を可能にする ms.Location new Point(0, 0); //フォーム左上端の位置を指定 ms.Size new Size(660, 520); //幅(640->660)と高さ(480->520)を指定 ms.Text "Game"; //タイトルを設定 ms.ControlBox false; ms.FormBorderStyle FormBorderStyle.Fixed3D; Application.Run(ms); //自オブジェクトへの参照をRunに与えることで開く }}/pre> /div>!-- .entry-content --> footer classentry-footer> span classcat-links>カテゴリー: a hrefhttps://ha205.rundog.org/?cat5 relcategory>講師より/a>/span>span classcomments-link>ディスカッション:a hrefhttps://ha205.rundog.org/?p1956#respond classcomments-link >コメントを残す/a>/span> /footer>!-- .entry-footer -->/article>!-- #post-## -->article classpost-1953 post type-post status-publish format-standard hentry category-5> header classentry-header> h2 classentry-title>a hrefhttps://ha205.rundog.org/?p1953 relbookmark>講義メモ 前半の続き/a>/h2> div classentry-meta> span classposted-on>投稿日: a hrefhttps://ha205.rundog.org/?p1953 relbookmark>time classentry-date published datetime2021-09-04T12:37:48+09:00>2021年9月4日/time>time classupdated datetime2021-09-04T12:44:51+09:00>2021年9月4日/time>/a>/span>span classbyline> 投稿者: span classauthor vcard>a classurl fn n hrefhttps://ha205.rundog.org/?author1>maurundog/a>/span>/span> /div>!-- .entry-meta --> /header>!-- .entry-header --> div classentry-content> p>p.405 LINQとは/p>pre>・SQL(データベース操作言語)に近い構文により、データ構造への検索を行う仕掛け・SQLによる検索のポイント:関数やメソッドとは異なり、データ構造が返されるので、受け取り側の扱いに注意・LINQの対象:配列などのデータ構造、XML文書など/pre>p>p.406 C#のクエリ/p>pre>・SQLにおけるクエリ(問い合わせ)構文例: SELECT 項目名,… FROM テーブル名 WHERE 抽出条件 ORDER BY 整列条件・C#では、特定のジェネリックインタフェースを型とするデータ構造(コレクション)に対して、SQLに似たLINQの構文を記述できる・LINQ用のジェネリックインタフェース IEnumerable<T>:T型のコレクションに対する単純な反復処理をサポートする列挙子を提供 (System.Collections.Generic名前空間) IQueryable<T>:T型のコレクションに対するクエリを評価する機能を提供 (LINQ専用でSystem.Linq名前空間)・LINQの利用はIEnumerable<T>を用いるが、内部的にIQueryable<T>が用いられるため、上記2つの名前空間が必要・クエリはIEnumerable<T>型の変数を定義し、クエリ式で初期化することで問合せ用オブジェクトを生成して行う IEnumerable<データ型> 変数 クエリ式;・クエリ式の書式例: from 項目名 in 対象名 where 条件式 select 項目名・配列の場合の書式例: from 作業変数 in 配列名 where 作業変数を用いた条件式 select 作業変数・得られた結果に対して、foreach構文で値の取り出しを行えばよい/pre>p>p.407 簡単なデータ抽出プログラム/p>pre>・LINQの利用には、VS2008以降が必要・補足:VS2010以降では参照設定の設定は不要(規定値になっている)/pre>p>p.408 linq01.cs 解説/p>pre>// p.408 linq01.cs 解説using System;font colorblue>using System.Linq; //内部的にIQueryable<T>用using System.Collections.Generic; //IEnumerable<T>用/font>class linq01 { public static void Main() { int numbers new int { -3, 4, 1, 2, -6, 3, 100, -25};font colorblue> // クエリの作成(int型配列なので型パラメータはint) IEnumerable<int> q from n in numbers where n > 0 select n; // クエリの実行(int型配列なので作業変数はint型) foreach (int x in q) Console.WriteLine(x);/font> }}/pre> /div>!-- .entry-content --> footer classentry-footer> span classcat-links>カテゴリー: a hrefhttps://ha205.rundog.org/?cat5 relcategory>講師より/a>/span>span classcomments-link>ディスカッション:a hrefhttps://ha205.rundog.org/?p1953#respond classcomments-link >コメントを残す/a>/span> /footer>!-- .entry-footer -->/article>!-- #post-## -->article classpost-1939 post type-post status-publish format-standard hentry category-5> header classentry-header> h2 classentry-title>a hrefhttps://ha205.rundog.org/?p1939 relbookmark>講義メモ/a>/h2> div classentry-meta> span classposted-on>投稿日: a hrefhttps://ha205.rundog.org/?p1939 relbookmark>time classentry-date published datetime2021-09-04T11:08:12+09:00>2021年9月4日/time>time classupdated datetime2021-09-04T12:03:39+09:00>2021年9月4日/time>/a>/span>span classbyline> 投稿者: span classauthor vcard>a classurl fn n hrefhttps://ha205.rundog.org/?author1>maurundog/a>/span>/span> /div>!-- .entry-meta --> /header>!-- .entry-header --> div classentry-content> p>前半:p.395「名前空間のネスト定義の省略」からbr />後半:全砲台から発射、開始画面(フォント文字列の表示)、ゲームモード/p>p>p.395 名前空間のネスト定義の省略/p>pre>・名前空間をネストした場合、内側の名前空間の定義内容は、名前空間名をドットでつないだ形の名前空間定義で表記できる・書式例: namespace 外側の名前空間名.内側の名前空間名 {…}・この時、外側の名前空間に所属する要素は、別途定義すること・また、usingの対象範囲が異なるので、都度定義すること/pre>p>p.396 namespace04.cs 解説/p>pre>// p.396 namespace04.cs 解説namespace Animal { //Animal名前空間の定義 using System; class Dog { //Animal.Dogクラスの定義 public string name; public void show() { System.Console.WriteLine("犬の名前は{0}です", name); } }}font colorblue>namespace Animal.Mammal.Cat { //ネストしている名前空間の定義/font> using System; // Animal名前空間でusing System;とあるがここでもう一度 class cat { //Animal.Mammal.Cat.catクラスの定義 public string name; public void show() { Console.WriteLine("猫の名前は{0}です", name); } }}namespace MyNamespace { //MyNamespace名前空間の定義 class Namespace03 { //MyNamespace.Namespace03クラスの定義 public static void Main() {font colorblue> Animal.Mammal.Cat.cat mycat new Animal.Mammal.Cat.cat();/font> mycat.name "マイケル"; mycat.show(); Animal.Dog mydog new Animal.Dog(); mydog.name "ポチ"; mydog.show(); } }}/pre>p>p.398 プリプロセッサ/p>pre>・C/C++から引き継がれた機能で、コンパイラ(C#システム)に対して前処理を指示できる機能・指示に用いる文字列をプリプロセッサディレクティブという・コンパイラ(C#システム)はプリプロセッサディレクティブに従って、ソースファイルを編集した結果をコンパイルする・プリプロセッサディレクティブにより、ソースの一部分をコンパイル対象から動的に除外するなどの制御が可能(コメントアウトトラブルの防止などに有効)・「#define シンボル」でシンボル文字列の定義をしておき、対象部分を「#if シンボル」と「#endif」で囲んでおけば、 #defineを削除することで、対象部分をコンパイルから除外できる・複数のシンボルを定義して論理関係演算子「&&」「||」でAND/OR指定が可能・論理否定演算子「!」を用いてNOT指定が可能・定義済みのシンボルは「#undef シンボル」で無効化できる・ただし、#defineによるマクロ定義はC#では不可 ※ C/C++の「#ifndef」を用いたインクルードガ-ドも不可/pre>p>p.400 preprocess01.cs 解説/p>pre>// p.400 preprocess01.cs 解説#define TESTusing System;class preprocess01 { public static void Main() {font colorblue>#if TEST/font> Console.WriteLine("テストです"); //シンボルTESTがあれば対象font colorblue>#endif#if (TEST && TEST2) //AND(かつ)/font> Console.WriteLine("ここは、TESTとTEST2が定義されていないとコンパイルされません");font colorblue>#endif#if (TEST || TEST2) //OR(または)/font> Console.WriteLine("ここは、TESTかTEST2が定義されていればコンパイルされます");font colorblue>#endif#if TEST2/font> Console.WriteLine("ここは、TEST2が定義されているとコンパイルされます");font colorblue>#endif/font> }}/pre>p>演習16-1 プリプロセッサの論理関係演算子/p>pre>・preprocess01.csを適当に書き換えて、 NOT指定が可能なこと AND指定とOR指定が同時に利用でき、ANDが優先であること 数式と同様にカッコで優先順を操作できること を確認しよう/pre>p>作成例/p>pre>// 演習16-1 プリプロセッサの論理関係演算子#define TEST#define TEST3using System;class preprocess01 { public static void Main() {font colorblue>#if !TEST/font> Console.WriteLine("テストです"); //シンボルTESTがなければ対象font colorblue>#endif#if (TEST3 || TEST && TEST2) //AND(かつ)が優先/font> Console.WriteLine("TESTとTEST2の両方か、TEST3が定義されている");font colorblue>#endif#if ((TEST3 || TEST) && TEST2) //カッコで優先順を操作/font> Console.WriteLine("TEST3とTESTのどちらかと、TEST2が定義されている");font colorblue>#endif/font> }}/pre>p>p.401 その他のプリプロセッサディレクティブ/p>pre>・「#if シンボル」と「#endif」の間に1つだけ「#else」を記述できる(if文のelseと同様)・「#if シンボル」と「#endif」の間にいくつでも「#elif シンボル」を記述できる(if文のelse ifと同様)/pre>p>演習16-2 その他のプリプロセッサディレクティブ/p>pre>・preprocess01.csを適当に書き換えて「#else」「#elif シンボル」の動作を確認しよう/pre>p>作成例/p>pre>// 演習16-2 その他のプリプロセッサディレクティブ#define TEST#define TEST3using System;class preprocess01 { public static void Main() {#if TEST Console.WriteLine("TESTが定義されている");font colorblue>#elif TEST2/font> Console.WriteLine("TESTではなくTEST2が定義されている");font colorblue>#elif TEST3/font> Console.WriteLine("TEST/TEST2ではなくTEST3が定義されている");font colorblue>#else/font> Console.WriteLine("TESTもTEST2もTEST3も定義されていない");#endif }}/pre>p>p.402 Conditional属性/p>pre>・C#独自の「メソッドの前にコンパイル対象にするかどうかの条件を付ける仕掛け」・Conditional属性を付けたメソッドを条件付きメソッドという・条件はプリプロセッサディレクティブと同様にシンボルを用いる・書式: Conditional(シンボル)・指定には、using System.Diagnostics; が必要・戻り値型がvoidで、オーバライドしていないメソッドであれば、条件付きメソッドにできる・条件付きメソッドがコンパイル対象から外れる場合、自動的に呼び出し部分も除外される・よって、プリプロセッサディレクティブの「#if」構文より使いやすい/pre>p>p.402 conditional01.cs 解説/p>pre>// p.402 conditional01.cs 解説using System;font colorblue>using System.Diagnostics; //Conditional属性用/font>class MyClass { public string name;font colorblue> Conditional("TEST") //シンボルTESTがないとshowメソッドは除外/font> public void show() { Console.WriteLine(name); }}class conditional01 { public static void Main() { MyClass mc new MyClass(); mc.name "マイケル"; mc.show(); //showメソッドが除外されたらこの行も除外される }}/pre>p>演習16-3 複数のConditional属性/p>pre>・conditional01.csを適当に書き換えて下記を確認しよう 複数のConditional属性をANDやORで指定することはできない しかし、1つのメソッドの前に複数のConditional属性を指定可能で、OR扱いになる/pre>p>作成例/p>pre>// 演習16-3 複数のConditional属性font colorblue>#define TEST/font>using System;using System.Diagnostics; //Conditional属性用class MyClass { public string name; Conditional("TEST") //シンボルTESTfont colorblue> Conditional("TEST2") //またはシンボルTEST2がないとshowメソッドは除外/font> public void show() { Console.WriteLine(name); }}class conditional01 { public static void Main() { MyClass mc new MyClass(); mc.name "マイケル"; mc.show(); //showメソッドが除外されたらこの行も除外される }}/pre> /div>!-- .entry-content --> footer classentry-footer> span classcat-links>カテゴリー: a hrefhttps://ha205.rundog.org/?cat5 relcategory>講師より/a>/span>span classcomments-link>ディスカッション:a hrefhttps://ha205.rundog.org/?p1939#respond classcomments-link >コメントを残す/a>/span> /footer>!-- .entry-footer -->/article>!-- #post-## -->article classpost-1923 post type-post status-publish format-standard hentry category-5> header classentry-header> h2 classentry-title>a hrefhttps://ha205.rundog.org/?p1923 relbookmark>今週の話題/a>/h2> div classentry-meta> span classposted-on>投稿日: a hrefhttps://ha205.rundog.org/?p1923 relbookmark>time classentry-date published datetime2021-09-04T10:35:39+09:00>2021年9月4日/time>time classupdated datetime2021-09-04T11:00:14+09:00>2021年9月4日/time>/a>/span>span classbyline> 投稿者: span classauthor vcard>a classurl fn n hrefhttps://ha205.rundog.org/?author1>maurundog/a>/span>/span> /div>!-- .entry-meta --> /header>!-- .entry-header --> div classentry-content> p>販売本数ランキング 今週首位は「月姫 -A piece of blue glass moon-」a hrefhttps://rundog.org/bbs/link.cgi?rhttps://www.famitsu.com/ranking/game-sales/ targettop relnoopener noreferrer>GO!/a>br />6本の新作発表も予告! THQ Nordic設立10周年を記念した初の公式デジタルショーケース開催決定 a hrefhttps://rundog.org/bbs/link.cgi?rhttps://www.gamebusiness.jp/article/2021/09/03/19013.html targettop relnoopener noreferrer>GO!/a>br />「PlayStation Showcase 2021」日本時間9月10日配信―ホリデーシーズン以降発売のPS5新作タイトル紹介 a hrefhttps://rundog.org/bbs/link.cgi?rhttps://www.gamebusiness.jp/article/2021/09/03/19012.html targettop relnoopener noreferrer>GO!/a>br />夢の共演、再び!「CAPCOMvs.手塚治虫CHARACTERS’」、池袋PARCOで10月1日より開催 a hrefhttps://rundog.org/bbs/link.cgi?rhttps://www.gamebusiness.jp/article/2021/09/02/19010.html targettop relnoopener noreferrer>GO!/a>br />「東京ゲームショウ2021 オンライン」公式番組タイムテーブル発表!スクエニやカプコンなど、計46番組を予定 a hrefhttps://rundog.org/bbs/link.cgi?rhttps://www.gamebusiness.jp/article/2021/09/02/19009.html targettop relnoopener noreferrer>GO!/a>br />Windows11が10月5日リリース決定!ゲーム機能を大幅強化 a hrefhttps://rundog.org/bbs/link.cgi?rhttps://www.gamebusiness.jp/article/2021/09/01/19006.html targettop relnoopener noreferrer>GO!/a>br />ゲームでプロの兵士に「リアル感」を持たせる動作とは?専門家が徹底実演解説する「銃器と装備、戦術戦技」【CEDEC2021】a hrefhttps://rundog.org/bbs/link.cgi?rhttps://www.gamebusiness.jp/article/2021/09/01/19002.html targettop relnoopener noreferrer>GO!/a>/p>p>Steam成人向けゲームで「白銀ノエル」「宝鐘マリン」らファンアートを無断使用―ホロライブ「事実関係を踏まえた上で対応を検討」a hrefhttps://rundog.org/bbs/link.cgi?rhttps://www.gamebusiness.jp/article/2021/09/01/19000.html targettop relnoopener noreferrer>GO!/a>br />中国が未成年に対するネットゲーム規制強化―利用は「週末と祝日の夜8時から9時のみ」a hrefhttps://rundog.org/bbs/link.cgi?rhttps://www.gamebusiness.jp/article/2021/08/31/18995.html targettop relnoopener noreferrer>GO!/a>br />Apple、児童ポルノ検知機能追加を延期 プライバシー抗議受け a hrefhttps://rundog.org/bbs/link.cgi?rhttps://www.itmedia.co.jp/news/articles/2109/04/news028.html targettop relnoopener noreferrer>GO!/a>br />国内のNFTマーケットに攻撃 一部のNFT作品が流出か 運営は補填を発表 a hrefhttps://rundog.org/bbs/link.cgi?rhttps://www.itmedia.co.jp/news/articles/2109/03/news151.html targettop relnoopener noreferrer>GO!/a>br />Google検索の“勝手にタイトルを変える仕様”に波紋 消費者庁などの注意喚起ページが逆の詐欺タイトルに a hrefhttps://rundog.org/bbs/link.cgi?rhttps://www.itmedia.co.jp/news/articles/2108/30/news131.html targettop relnoopener noreferrer>GO!/a>br />AWSで障害、ネットワーク接続に問題 GitHubも同時期に一時アクセスしづらい状態に【復旧済み】a hrefhttps://rundog.org/bbs/link.cgi?rhttps://www.itmedia.co.jp/news/articles/2109/02/news088.html targettop relnoopener noreferrer>GO!/a>br />石倉デジタル監、有料素材のサンプル画像を無断転載で謝罪 個人サイトを一時閉鎖、Twitterアカウントも一時非公開に a hrefhttps://rundog.org/bbs/link.cgi?rhttps://www.itmedia.co.jp/news/articles/2109/03/news123.html targettop relnoopener noreferrer>GO!/a>/p> /div>!-- .entry-content --> footer classentry-footer> span classcat-links>カテゴリー: a hrefhttps://ha205.rundog.org/?cat5 relcategory>講師より/a>/span>span classcomments-link>ディスカッション:a hrefhttps://ha205.rundog.org/?p1923#respond classcomments-link >コメントを残す/a>/span> /footer>!-- .entry-footer -->/article>!-- #post-## --> nav classnavigation posts-navigation rolenavigation aria-label投稿ナビゲーション> h2 classscreen-reader-text>投稿ナビゲーション/h2> div classnav-links>div classnav-previous>a hrefhttps://ha205.rundog.org/?paged2 >← 古い投稿/a>/div>/div> /nav>/div>!-- .content-area -->aside classsidebar-1 widget-area> section classwidget widget_text>h3 classwidget-title>ご注意/h3> div classtextwidget>p>このサイトのURLの公開・転載やリンクは、strong>明示・暗示を問わず絶対にしないでください/strong>。また、お仕事先のネットワークからの利用はお止め下さい。事前の連絡無くサービスを終了する場合があります。/p>/div> /section>section classwidget widget_search>h3 classwidget-title>サイト内検索/h3>form rolesearch methodget classsearch-form actionhttps://ha205.rundog.org/> label> span classscreen-reader-text>検索:/span> input typesearch classsearch-field placeholder検索… value names /> /label> input typesubmit classsearch-submit value検索 /> /form>/section>section classwidget widget_text>h3 classwidget-title>リンク/h3> div classtextwidget>p>a hrefhttps://ha205.rundog.org/wp-content/uploads/2020/10/ha205.pdf targettop relnoopener noreferrer>スケジュール/a>br />a hrefhttps://ha205.rundog.org/wp-content/uploads/2020/11/NekoCS3_Sample_ed.zip>ソース一式/a>br />a hrefhttps://rundog.org/bbs/link.cgi?rhttp://neko.sbcr.jp/neko_c_sharp.html targettop relnoopener noreferrer>テキスト公式ページ/a>br />a hrefhttps://rundog.org/bbs/link.cgi?rhttps://msdn.microsoft.com/library targettop relnoopener noreferrer>APIリファレンス/a>br />a hrefhttps://rundog.org/bbs/link.cgi?rhttp://www.wisdomsoft.jp/479.html targettop relnoopener noreferrer><参考>C#ゲームプログラミング/a>br />a hrefhttps://rundog.org/bbs/link.cgi?rhttps://rundog.org/ targettop relnoopener noreferrer>講師のサイト/a>br />a hrefhttps://rundog.org/bbs/link.cgi?rhttps://ameblo.jp/maurundog/ targettop relnoopener noreferrer>ブログ/a>br />a hrefhttps://rundog.org/bbs/link.cgi?rhttps://twitter.com/maurundog/ targettop relnoopener noreferrer>Twitter/a>br />a hrefhttps://rundog.org/bbs/link.cgi?rhttps://www.facebook.com/maurundog targettop relnoopener noreferrer>Facebook/a>br />a hrefhttps://rundog.org/bbs/link.cgi?rhttps://www.youtube.com/channel/UC6VurzFHXlwkOKaTUj352cg/videos targettop relnoopener noreferrer>Youtubeチャンネル/a>/p>/div> /section>/aside>!-- #secondary --> /div>!-- .wrapper --> /div>!-- .site-content --> footer classsite-footer> div classwrapper> div classsite-info> Theme: a relnofollow hrefhttps://olympusthemes.com/themes/scaffold/>Scaffold/a> by Danny Cooper /div>!-- .site-info --> /div>!-- .wrapper --> /footer>!-- .site-footer -->script typetext/javascript srchttps://ha205.rundog.org/wp-includes/js/dist/vendor/wp-polyfill.min.js?ver7.4.4 idwp-polyfill-js>/script>script typetext/javascript idwp-polyfill-js-after>( fetch in window ) || document.write( script srchttps://ha205.rundog.org/wp-includes/js/dist/vendor/wp-polyfill-fetch.min.js?ver3.0.0>/scr + ipt> );( document.contains ) || document.write( script srchttps://ha205.rundog.org/wp-includes/js/dist/vendor/wp-polyfill-node-contains.min.js?ver3.42.0>/scr + ipt> );( window.DOMRect ) || document.write( script srchttps://ha205.rundog.org/wp-includes/js/dist/vendor/wp-polyfill-dom-rect.min.js?ver3.42.0>/scr + ipt> );( window.URL && window.URL.prototype && window.URLSearchParams ) || document.write( script srchttps://ha205.rundog.org/wp-includes/js/dist/vendor/wp-polyfill-url.min.js?ver3.6.4>/scr + ipt> );( window.FormData && window.FormData.prototype.keys ) || document.write( script srchttps://ha205.rundog.org/wp-includes/js/dist/vendor/wp-polyfill-formdata.min.js?ver3.0.12>/scr + ipt> );( Element.prototype.matches && Element.prototype.closest ) || document.write( script srchttps://ha205.rundog.org/wp-includes/js/dist/vendor/wp-polyfill-element-closest.min.js?ver2.0.2>/scr + ipt> );/script>script typetext/javascript idcontact-form-7-js-extra>/* !CDATA */var wpcf7 {api:{root:https:\/\/ha205.rundog.org\/index.php?rest_route\/,namespace:contact-form-7\/v1}};/* > *//script>script typetext/javascript srchttps://ha205.rundog.org/wp-content/plugins/contact-form-7/includes/js/index.js?ver5.4.1 idcontact-form-7-js>/script>script typetext/javascript srchttps://ha205.rundog.org/wp-content/plugins/drag-and-drop-multiple-file-upload-contact-form-7/assets/js/codedropz-uploader-min.js?ver1.3.5.9 idcodedropz-uploader-js>/script>script typetext/javascript iddnd-upload-cf7-js-extra>/* !CDATA */var dnd_cf7_uploader {ajax_url:https:\/\/ha205.rundog.org\/wp-admin\/admin-ajax.php,ajax_nonce:a29076426d,drag_n_drop_upload:{tag:h4,text:\u3053\u3053\u306b\u30d5\u30a1\u30a4\u30eb\u3092\u30c9\u30ed\u30c3\u30d7\u3059\u308b,or_separator:\u304b,browse:\u3053\u3053\u3092\u30af\u30ea\u30c3\u30af\u3057\u3066\u30d5\u30a1\u30a4\u30eb\u3092\u9078\u3093\u3067\u304f\u3060\u3055\u3044,server_max_error:The uploaded file exceeds the maximum upload size of your server.,large_file:Uploaded file is too large,inavalid_type:Uploaded file is not allowed for file type,max_file_limit:Note : Some of the files are not uploaded ( Only %count% files allowed ),required:This field is required.,delete:{text:deleting,title:Remove}},dnd_text_counter:of,disable_btn:};/* > *//script>script typetext/javascript srchttps://ha205.rundog.org/wp-content/plugins/drag-and-drop-multiple-file-upload-contact-form-7/assets/js/dnd-upload-cf7.js?ver1.3.5.9 iddnd-upload-cf7-js>/script>script typetext/javascript srchttps://ha205.rundog.org/wp-content/themes/scaffold/assets/js/navigation.js?ver1.3.1 idscaffold-navigation-js>/script>script typetext/javascript srchttps://ha205.rundog.org/wp-includes/js/wp-embed.min.js?ver5.5.15 idwp-embed-js>/script>/div>!-- .site-wrapper -->/body>/html>
View on OTX
|
View on ThreatMiner
Please enable JavaScript to view the
comments powered by Disqus.
Data with thanks to
AlienVault OTX
,
VirusTotal
,
Malwr
and
others
. [
Sitemap
]