HSPポータル
サイトマップ お問い合わせ


HSPTV!掲示板


未解決 解決 停止 削除要請

2017
0624
ℭℜℴñusCircleTraining開発中...1未解決


ℭℜℴñus

リンク

2017/6/24(Sat) 09:35:44|NO.80373

CircleTraining というゲームを開発中なんですが、
付けたいっていうか必要な機能を付けたいです。


//拡張機能を読み込む #include "gdi32.as" #include "hspsock.as" #include "d3m.hsp" //必要となるAPIや関数の定義 #uselib "user32" #cfunc GetSystemMenu "GetSystemMenu" int, nullptr #func GetClassLong "GetClassLongA" sptr,sptr #func SetClassLong "SetClassLongA" sptr,sptr,sptr #func SetWindowLong "SetWindowLongA" sptr,sptr,sptr #func SetWindowPosA "SetWindowPos" int, nullptr, nullptr, nullptr, nullptr, nullptr, int #func SetWindowPosB "SetWindowPos" sptr,sptr,sptr,sptr,sptr,sptr,sptr #func DeleteMenu "DeleteMenu" int, int, nullptr #func SystemParametersInfo "SystemParametersInfoA" sptr,sptr,sptr,sptr #func SetProcessDPIAware "SetProcessDPIAware" #define ctype RGB(%1,%2,%3) (%1 | %2 << 8 | %3 << 16) #define ctype limitFPS(%1, %2) 1000.0*%1/(%2*%2) //パック #packopt name "CircleTraining" //モジュール開始 #module #uselib "kernel32" #func GetNumberFormat "GetNumberFormatA" int, int, str, int, int, int #define ctype max( %1, %2 ) ( %1 )*( %1 > %2 ) + ( %2 )*( %1 <= %2 ) #define ctype min( %1, %2 ) ( %1 )*( %1 < %2 ) + ( %2 )*( %1 >= %2 ) #define bgrect(%1,%2,%3,%4) grect %1+%3/2,%2+%4/2,0,%3,%4 #const DEFAULT_R 20 #deffunc rboxf int _x1, int _y1, int _x2, int _y2, int _r x1 = min(_x1, _x2) : x2 = max(_x1, _x2) y1 = min(_y1, _y2) : y2 = max(_y1, _y2) box_width = x2 - x1 : box_height = y2 - y1 if ( _r <= 0 ) { r = DEFAULT_R } else { r = _r } r = min( r, min( box_width / 2, box_height / 2 ) ) boxf x1, y1+r, x2, y2-r boxf x1+r, y1, x2-r, y2 repeat 4 x = x1 + ( cnt \ 2 ) * ( box_width - r * 2 + 1) y = y1 + ( cnt / 2 ) * ( box_height - r * 2 + 1 ) circle x, y, x + r * 2, y + r * 2 loop return 0 #deffunc DataSave str dataname, var datavar bsave ""+dataname+".dat",datavar return 0 #deffunc DataLoad str dataname, var datavar exist ""+dataname+".dat" if strsize != -1 { bload ""+dataname+".dat",datavar return 1 } return 0 #defcfunc ThousandSep str p1 dim NUMBERFMT, 6 lpDecimalSep = "." : lpThousandSep = "," NUMBERFMT = 0, 0, 3, varptr(lpDecimalSep), varptr(lpThousandSep), 1 sdim lpNumberStr GetNumberFormat , , p1, varptr(NUMBERFMT), varptr(lpNumberStr), 64 return lpNumberStr #deffunc gboxf int bx1, int by1, int bx2, int by2, int cr, int cg, int cb gmode 3,0,0,128 : color cr,cg,cb bgrect bx1,by1,bx2,by2 gmode 0 return 0 #deffunc acls onkey 0 onclick 0 mouse return 0 //モジュール終了 #global //変数の宣言 dim hInput, 1 sdim word,1024 repeat 10 Nickname(cnt)="" loop myr = 0 myg = 128 myb = 255 //画面作成 SetProcessDPIAware screen 0,ginfo(20),ginfo(21),0,0,0 width 640*2,480*2,ginfo(20)/2-640,ginfo(21)/2-480 //タイトル名 title "CircleTraining ver1.0" *menustart //初期化 clrobj acls colorsw = 0 //絶対に必要な命令 oncmd gosub *ctlcoloredit, $133 onexit *exit //背景 color 10,10,50 : boxf //ニックネーム入力ボックス color 124,92,220 : Nickname="" rboxf ginfo_winx/2-120*2,ginfo_winy/2-40*2,ginfo_winx/2+130*2,ginfo_winy/2+20*2,100*2 font "メイリオ",100,1 color 124,92,220 pos 150*2,50*2 : mes "Circle" color 0,255,128 pos 300*2,50*2 : mes "Training" font "メイリオ",35,0 : objmode 2 pos ginfo_winx/2-97*2,ginfo_winy/2-23*2 : input Nickname,200*2,30*2,13 hInput.0 = objinfo(stat, 2) CreateSolidBrush RGB(124, 92, 220) hBrush.0 = stat SetWindowLong objinfo (0, 2), -20, $0 SetWindowPosA objinfo (0, 2), $27 //判定 repeat //描画開始 redraw 0 //初期化 acls //ボタン作成 if bflag = 0 : color 0,160,120 if bflag = 1 : color 0,255,160 rboxf ginfo_winx/2-50*2,ginfo_winy/2+40*2,ginfo_winx/2+75*2,ginfo_winy/2+80*2,100*2 if mousex >= ginfo_winx/2-50*2 & mousey >= ginfo_winy/2+40*2 & mousex <= ginfo_winx/2-100+176*2 & mousey <= ginfo_winy/2+80*2 { bflag = 1 onclick *start stick StartK if StartK = 32 { goto *start } } else { bflag = 0 } color 255,255,255 font "メイリオ",60,1 pos ginfo_winx/2-20*2-1,ginfo_winy/2+39*2 : mes "Play" if bflag1 = 0 : color 0, 64, 255 if bflag1 = 1 : color 0, 160, 255 circle (50-40)*2, (430-40)*2, (50+40)*2, (430+40)*2 if (((50*2 - mousex) * (50*2 - mousex) + (430*2 - mousey)*(430*2 - mousey)) < 40*2*40*2 ) { onclick goto *skin stick StartSK if StartSK = 32 { goto *skin } bflag1 = 1 } else { bflag1 = 0 } color 255,255,255 font "メイリオ",60,1 pos 17*2-3,ginfo_winy-70*2 : mes "Skin" //描画終了 redraw 1 //時間待ち await 1 loop //ゲーム開始準備 *start //初期化 acls cls 4 clrobj //常に最大化されているウィンドウを作成 fla=int((ginfo(10)-ginfo(12))/2) tit=ginfo(11)-ginfo(13)-fla dim u_zone,4 SystemParametersInfo $30,0,varptr(u_zone),0 max_wid=u_zone(2)-u_zone(0) max_hei=u_zone(3)-u_zone(1)-tit width max_wid,max_hei SetWindowPosB hwnd,0,u_zone(0)-fla,u_zone(1),0,0,$5 hSystemMenu = GetSystemMenu (hwnd) DeleteMenu hSystemMenu, $F010 //変数宣言 if mode = 0 | mode = 2 : cheatok = 0 if mode = 1 | mode = 3 : cheatok = 1 randomize world = "001" speed = 15.0 size = 120.0 lv = 0 score = 10 esa_max = 1000 LoadSocre = 60 MapLoad = 60 RankingN = 1 repeat esa_max esar(cnt)=rnd(206)+50 esag(cnt)=rnd(206)+50 esab(cnt)=rnd(206)+50 esax(cnt)=rnd(10000)+2000 esay(cnt)=rnd(10000)+1000 esasize(cnt)=rnd(20) loop mx = rnd(10000)*-1 my = rnd(10000)*-1 repeat 10,0 Scoreboard(cnt) = 0 loop //メインループ *mainloop //描画開始 redraw 0 //初期化 acls //背景 color 10,10,50 : boxf //変数管理 randomize if score >= sizeupscore { size = size + 7.0 sizeupscore = sizeupscore + score / 2 lv = lv + 1 } if mx*-1 <= 0 : mx = 0 if my*-1 <= 0 : my = 0 if mx*-1 > 10000 : mx = -10000 if my*-1 > 10000 : my = -10000 if size >= 500.0 : size = 500.0 LoadSocre = LoadSocre + 1 //餌を描画 repeat esa_max esaM = rnd(40000) if esaM > 0 & esaM < 10000 { esax(cnt) += rnd(2)+2 } if esaM > 10000 & esaM < 20000 { esax(cnt) -= rnd(2)+2 } if esaM > 20000 & esaM < 30000 { esay(cnt) += rnd(2)+2 } if esaM > 30000 & esaM < 40000 { esay(cnt) -= rnd(2)+2 } color esar(cnt),esag(cnt),esab(cnt) circle esax(cnt)+mx,esay(cnt)+my,esax(cnt)+mx+(esasize(cnt)+5),esay(cnt)+my+(esasize(cnt)+5),1 if (ginfo_winx/2-(size+1)+2)<(esax(cnt)+mx)&&((ginfo_winy/2-(size+1))-12)<(esay(cnt)+my)&&(ginfo_winx/2+(size+1)+12)>(esax(cnt)+mx+(esasize(cnt)+5))&&(ginfo_winy/2+(size+1)-2)>(esay(cnt)+my+(esasize(cnt)+5)){ score = score + ((rnd(10) + 1) * (lv * 2)) * (esasize(cnt)+5) if score >= 999999999 : score = 999999999 } loop //自機描画 gosub *setskin if skinID != 9 { color myr,myg,myb circle ginfo_winx/2-(size+1)+2,(ginfo_winy/2-(size+1))-12,ginfo_winx/2+(size+1)+12,ginfo_winy/2+(size+1)-2,1 } color 255,255,255 font "メイリオ",40,1 moji = ThousandSep(""+score+"") msgx = ginfo_winx/2-(strlen(moji)*10)-(strlen(moji)+1/2*3)-(strlen(moji)-3) pos msgx,ginfo_winy/2-35 mes moji rad = atan(mousex-ginfo(10)/2, mousey-ginfo(11)/2) + M_PI mx = mx + sin(rad)*(speed) my = my + cos(rad)*(speed) if score < 10 : score = 10 //スコアボード表示 gboxf ginfo_winx-(300*2),0,ginfo_winx,(160*2+15),0,0,0 if LoadSocre \ 60 = 0{ Scoreboard = score } font "メイリオ",32,0 color 255,255,255 pos ginfo_winx-(259*2-127),10 mes "Scoreboard" repeat 10,0 if NickName(cnt) = "" : NickName(cnt) = "" font "メイリオ",26,0 : color 255,255,255 pos ginfo_winx-(300*2-10*2),(cnt+2)*26 : mes "#"+strf("%02d",(cnt+1)) pos ginfo_winx-(300*2-45*2),(cnt+2)*26 : mes NickName(cnt) pos ginfo_winx-(300*2-215*2),(cnt+2)*26 : mes " "+strf("%09d",Scoreboard(cnt)) loop //情報取得 color 255,255,255 font "メイリオ",30,0 pos ginfo_winx-(259*2),(160*2+20) : mes "FPS: "+d3getfps() ipget : pos ginfo_winx-(259*2),(160*2+60) : mes "IP: "+refstr+"."+world pos ginfo_winx-(259*2),(160*2+100) : mes "X: "+mx*-1 pos ginfo_winx-(259*2),(160*2+140): mes "Y: "+my*-1 //地図描画 color 0,0,0 boxf ginfo_winx-(170*2),ginfo_winy-(170*2),ginfo_winx-(10*2),ginfo_winy-(10*2) if RankingN = 1 { color 255,255,0 } else { color 255,255,255 } if MapLoad \ 60 = 0 { pos (((ginfo_winx-(160*2))+2+(mx/150)*-4)-(5*2)),(((ginfo_winy-(150*2))+2+(my/150)*-4)-(15*2)) } mes "●" color 255,0,0 line ginfo_winx-(170*2),ginfo_winy-(170*2),ginfo_winx-(170*2),ginfo_winy-(7*2) line ginfo_winx-(170*2),ginfo_winy-(170*2),ginfo_winx-(10*2),ginfo_winy-(170*2) line ginfo_winx-(10*2),ginfo_winy-(170*2),ginfo_winx-(10*2),ginfo_winy-(7*2) line ginfo_winx-(170*2),ginfo_winy-(7*2),ginfo_winx-(10*2),ginfo_winy-(7*2) //描画終了 redraw 1 //時間待ち await 1 //メインループへ goto *mainloop //スキンメニュー *skin //初期化 dim skinIDN,10 SkinNameD = "RedColor","GreenColor","BlueColor","RedRubyColor","GreenEmeraldColor","BlueSapphireColor","CoinSkin","RandomSuperSkin","DarkColor","TransparentColor","GoldenYellowColor" ssize = 300 acls clrobj //判定 repeat -1 //描画開始 redraw 0 //背景 color 10,10,50 : boxf //メニュー color 160,160,200 rboxf 30*2,30*3,ginfo_winx-19*3,ginfo_winy-30*3,10 gosub *setskin colorin = colorin + 1 font "メイリオ",60,1 color myr,myg,myb pos 40*2,50*2 mes SkinNameD(skinID) getkey kcsd, 37 if kcsd = 1 & _kcsd = 0 { skinID = skinID - 1 } getkey kcsu, 39 if kcsu = 1 & _kcsu = 0 { skinID = skinID + 1 } if skinID < 0 : skinID = 0 if skinID > 10 : skinID = 10 _kcsd = kcsd _kcsu = kcsu stick SetSkinK,32 if SetSkinK = 32 { goto *menustart } //時間待ち await 1 //描画終了 redraw 1 //ループ loop *setskin if skinID = 0 { myr = 255 myg = 64 myb = 64 } if skinID = 1 { myr = 64 myg = 128 myb = 64 } if skinID = 2 { myr = 64 myg = 64 myb = 255 } if skinID = 3 { if colorin \ 5 = 0 { myr = rnd(128)+128 myg = 0 myb = 0 } } if skinID = 4 { if colorin \ 5 = 0 { myr = 0 myg = rnd(64)+64 myb = 0 } } if skinID = 5 { if colorin \ 5 = 0 { myr = 0 myg = 0 myb = rnd(128)+128 } } if skinID = 6 { myr = 255 myg = 180 myb = 0 } if skinID = 7 { if colorin \ 10 = 0 { myr = rnd(156)+100 myg = rnd(156)+100 myb = rnd(156)+100 } } if skinID = 8 { myr = 0 myg = 0 myb = 0 } if skinID = 9 { myr = 10 myg = 10 myb = 50 } if skinID = 10 { if colorin \ 4 = 0 { myr = 255 myg = 255-rnd(50) myb = 0 } } colorin = colorin + 1 return //mesboxの色指定 *ctlcoloredit if hInput.0 = lparam { SetTextColor wparam, RGB($FF, $FF ,$FF) SetBkColor wparam, RGB(124, 92, 220) return hBrush.0 } return //終了時 *exit DeleteObject hBrush.0 end

■付けたい機能
・他のプレイヤーを見せる(イメージ↓)
 https://www.bing.com/images/search?view=detailV2&ccid=DopqoxJo&id=30B4C9E0C1EBC50D0F8554CECDED1708E36BF455&thid=OIP.DopqoxJoaBWnyxccERB3WQEsDh&q=%e3%82%aa%e3%83%b3%e3%83%a9%e3%82%a4%e3%83%b3%e3%82%b2%e3%83%bc%e3%83%a0&simid=608007937186859269&selectedIndex=231&ajaxhist=0
・スコアボード(オンライン)の処理(305〜319行目)←絶対入れたい
・餌を描画の中の餌に当たったらその餌が消える判定(281〜284行目)←消した方が楽しみ感(?)がある
・全体的に処理の高速化(352行目)←オンラインゲームとなると増えるから速くしたほうが良い
 
 まだ出来ない所が沢山あります(特にネット関係)。
 自分も頑張って調べているので何方か教えて下さい。
 要望が多くてすいません。



この記事に返信する


ℭℜℴñus

リンク

2017/6/24(Sat) 10:35:18|NO.80375

こんなの見つけました(pcbnet2)
http://www.sharkpp.net/blog/2008/09/06/hsp-pcbnet2.html
結構いいです。どうすれば利用できるのでしょうか?



ONION software Copyright 1997-2023(c) All rights reserved.