作ってる間にht.さんに先越されましたがもったいないので投下
#module
#deffunc drawcomment_init array comment_ , int screenw_,int second_, int fps_
screenw = screenw_
second = second_
fps = fps_
sdim comment,64,length(comment_)
repeat length(comment_)
comment.cnt = comment_.cnt
loop
dim count,length(comment)
dim commentsizew,length(comment)
repeat length(comment)
mes comment.cnt
commentsizew.cnt = ginfo(14)
speed.cnt = (( 0.0 + screenw + commentsizew.cnt) / (second*fps))
loop
return
#deffunc drawcomment int p1, double p2, int p3
if cnt > ((p2*1000)/fps) {
pos limit( (screenw-( speed(p1) * count(p1) )) , ( commentsizew(p1) * -2 ) , screenw ), p3
mes comment.(p1)
count(p1)++
}
return
#deffunc hold60fps
a++
if a != 3{
await 17
} else {
a=0
await 16
}
return
#deffunc hold30fps
a++
if a != 3{
await 33
} else {
a=0
await 34
}
return
/*
各命令の説明
drawcomment_init array p1, int p2, int p3, int p4
drawcommentの初期化命令
p1 sdimで確保した流したいコメントの配列変数を入れる
p2 スクリーンの横幅
p3 コメントが流れる時間(秒)
p4 repeat-loop内のフレームレート(await 16なら60、await 33なら30。hold60fps、hold30fpsを使うと便利)
drawcomment int p1, double p2, int p3
実際に流れるコメントを書く命令
p1 sdimで確保した流したいコメントの配列変数の番号(0〜)
p2 repeat-loop内で何秒目に流れ始めるか
p3 コメントの高さ
hold30fps (hold60fps)
await 33(16)より正確に30(60)fpsを保つ命令
引数無し
*/
#global
上のモジュールを保存して#includeでお使いください(ファイル名はご自由に)
使い方例
上記モジュールをnicomment.asとして保存した例
#include "nicomment.as"
buffer 1,640,480
gradf 0,0,640,480,0,0xEE4444,0xEEEE44
screen 0,640,480
font msgothic,31,1
sdim comment,64,10
comment.0 = "こんにちは"
comment.1 = "キタ━━━━(゚∀゚)━━━━!!"
comment.2 = "orz"
comment.3 = "でうfh9えw7fげwfh9えwfげwrへhb"
buffer 2,1000,50
font msgothic,31,1
drawcomment_init comment, 640, 4, 30
gsel 0
repeat
redraw 0
pos 0,0
gcopy 1,0,0,640,480
drawcomment 0, 1.0, 50
drawcomment 1, 1.5, 90
drawcomment 2, 2.0, 120
drawcomment 3, 0.3, 120
redraw 1
hold30fps
loop
説明
sdimで配列変数を作り、流したいコメントを入れる(9〜13行目)
適当なbufferを作り(IDは何でもいい)、drawcomment_initを実行する(15、18行目)
スクリーンにfont命令を使う場合はbufferにも同じフォントを指定する(16行目)
drawcomment_initの説明はモジュールをご覧ください
repeat-loop内でdrawcommentを実行(27〜30行目)
drawcommentの説明はモジュールを(ry
------
とメインのソースに書くのはたったこれだけで、モジュールをincludeするだけの簡単仕様です!
わからないことがあったら言ってください