當前位置:首頁 » 編程軟體 » 魔塔編程題

魔塔編程題

發布時間: 2022-08-28 03:42:21

❶ 魔塔的問題

1、插入個新腳本(用復制)。
#==============================================================================
# ■ Window_Demons
#------------------------------------------------------------------------------
# 顯示戰斗的窗口。
#==============================================================================

class Window_Demons < Window_Base
#--------------------------------------------------------------------------
# ● 初始化窗口
#--------------------------------------------------------------------------
def initialize
super(0, 0, 296, 128)
self.contents = Bitmap.new(width - 28, height - 30)
@width = self.width
self.x = 320-@width/2
self.y = 240-96
end
#--------------------------------------------------------------------------
# ● 刷新
#--------------------------------------------------------------------------
def refresh(actor,event)
self.contents.clear
self.contents.font.size = 16
enemy = event.enemy
w = get(enemy.name)
self.contents.draw_text(@width-w-32,0,w,16,enemy.name)
w = get("血:#{enemy.hp}")
self.contents.draw_text(@width-w-32,16,w,16,"血:" + (enemy.hp.to_s))
w = get("攻擊:#{enemy.atk}")
self.contents.draw_text(@width-w-32,48,w,16,"攻擊:" + (enemy.str.to_s))
w = get("防禦:#{enemy.pdef}")
self.contents.draw_text(@width-w-32,64,w,16,"防禦:" + (enemy.dex.to_s))
unless enemy.skill.nil?
w = get("Skill:" + (enemy.skill.name))
else
w = get("Skill:" + ("無"))
end
unless enemy.skill.nil?
self.contents.draw_text(@width-w-32,80,w,16,"Skill:" + (enemy.skill.name))
else
self.contents.draw_text(@width-w-32,80,w,16,"Skill:" + ("無"))
end
draw_actor_graphic($game_party.actors[0], 85, 32)

self.contents.draw_text(3, 83, 70, 70, @pro2.to_s)
self.contents.font.color = text_color(2)
self.contents.draw_text(170, 0, 50, 30, "V S")
self.contents.draw_text(230, 83, 70, 70, @pro.to_s)
self.contents.font.color = text_color(3)
@pro2=" 普通"
@v=$game_variables[91]
if $game_party.item_number(@v[0])>=1
self.contents.font.color = text_color(2)
@pro2=" 炎"
end
if $game_party.item_number(@v[4])>=1
self.contents.font.color = text_color(4)
@pro2=" 冰"
end
if $game_party.item_number(@v[3])>=1
self.contents.font.color = text_color(6)
@pro2=" 靈"
end

self.contents.draw_text(4,0,get(actor.name),16,actor.name)
self.contents.draw_text(4,16,get((actor.hp.to_s) + ":HP"),16,(actor.hp.to_s) + ":血")
self.contents.draw_text(4,48,get((actor.str.to_s) + ":str"),16,(actor.str.to_s) + ":攻擊")
self.contents.draw_text(4,64,get((actor.dex.to_s) + ":dex"),16,(actor.dex.to_s) + ":防禦")
end
end
改掉Game_Battler。
#==============================================================================
# ■ Game_Battler (分割定義 3)
#------------------------------------------------------------------------------
# 處理戰斗者的類。這個類作為 Game_Actor 類與 Game_Enemy 類的
# 超級類來使用。
#==============================================================================

class Game_Battler
#--------------------------------------------------------------------------
# ● 應用通常攻擊效果
# attacker : 攻擊者 (battler)
#--------------------------------------------------------------------------
def attack_effect(attacker)
# 計算基本傷害
str = [attacker.str - 0].max
self.damage =attacker.str - dex / 1
# HP 的傷害計算
# 狀態變化
# Miss 的情況下
self.hp -= self.damage
end
end
再插入。
class Game_DemonsEnemy < Game_Battler
#--------------------------------------------------------------------------
# ● 初始化對像
# id : ID
#--------------------------------------------------------------------------
def initialize(id)
super()
enemy = $data_enemies[id]
@enemy_id = enemy.id
@battler_name = enemy.battler_name
@battler_hue = enemy.battler_hue
@hp = maxhp
@sp = maxsp
end
def skill?
if self.actions[0].nil?
return false
end
# if @sp <= skill.sp_cost
return false
end
# return rand(100) > (100 - (self.actions[0].rating * 10))
end
def skill
if self.actions[0].nil?
return nil
end
if self.actions[0].kind == 1
return $data_skills[self.actions[0].skill_id]
else
return nil
end
end
#--------------------------------------------------------------------------
# ● 獲取敵人 ID
#--------------------------------------------------------------------------
def id
return @enemy_id
end
#--------------------------------------------------------------------------
# ● 獲取索引
#--------------------------------------------------------------------------
def index
return @member_index
end
#--------------------------------------------------------------------------
# ● 獲取名稱
#--------------------------------------------------------------------------
def name
return $data_enemies[@enemy_id].name
end
#--------------------------------------------------------------------------
# ● 獲取基本 MaxHP
#--------------------------------------------------------------------------
def base_maxhp
return $data_enemies[@enemy_id].maxhp
end
#--------------------------------------------------------------------------
# ● 獲取基本力量
#--------------------------------------------------------------------------
def base_str
return $data_enemies[@enemy_id].str
end
#--------------------------------------------------------------------------
# ● 獲取基本靈巧
#--------------------------------------------------------------------------
def base_dex
return $data_enemies[@enemy_id].dex
end
#--------------------------------------------------------------------------
# ● 普通攻擊 獲取攻擊方動畫 ID
#--------------------------------------------------------------------------
def animation1_id
return $data_enemies[@enemy_id].animation1_id
end
#--------------------------------------------------------------------------
# ● 普通攻擊 獲取對像方動畫 ID
#--------------------------------------------------------------------------
def animation2_id
return $data_enemies[@enemy_id].animation2_id
end
#--------------------------------------------------------------------------
# ● 獲取 EXP
#--------------------------------------------------------------------------
def exp
return $data_enemies[@enemy_id].exp
end
#--------------------------------------------------------------------------
# ● 獲取金錢
#--------------------------------------------------------------------------
def gold
return $data_enemies[@enemy_id].gold
end #--------------------------------------------------------------------------
def make_action
# 清除當前行動
self.current_action.clear
# 無法行動的情況
unless self.movable?
# 過程結束
return
end
# 抽取現在有效的行動
available_actions = []
rating_max = 0
for action in self.actions
# 確認回合條件
n = $game_temp.battle_turn
a = action.condition_turn_a
b = action.condition_turn_b
if (b == 0 and n != a) or
(b > 0 and (n < 1 or n < a or n % b != a % b))
next
end
# 確認 HP 條件
if self.hp * 100.0 / self.maxhp > action.condition_hp
next
end
# 確認等級條件
if $game_party.max_level < action.condition_level
next
end
# 確認開關條件
switch_id = action.condition_switch_id
if switch_id > 0 and $game_switches[switch_id] == false
next
end
# 符合條件 : 添加本行動
available_actions.push(action)
if action.rating > rating_max
rating_max = action.rating
end
end
# 最大概率值作為 3 合計計算(0 除外)
ratings_total = 0
for action in available_actions
if action.rating > rating_max - 3
ratings_total += action.rating - (rating_max - 3)
end
end
# 概率合計不為 0 的情況下
if ratings_total > 0
# 生成隨機數
value = rand(ratings_total)
# 設置對應生成隨機數的當前行動
for action in available_actions
if action.rating > rating_max - 3
if value < action.rating - (rating_max - 3)
self.current_action.kind = action.kind
self.current_action.basic = action.basic
self.current_action.skill_id = action.skill_id
self.current_action.decide_random_target_for_enemy
return
else
value -= action.rating - (rating_max - 3)
end
end
end
end
end
修改腳本:
在Game_Event裡面的。
#--------------------------------------------------------------------------
# ● 定義實例變數
#--------------------------------------------------------------------------
attr_reader :trigger # 目標
attr_reader :list # 執行內容
attr_reader :starting # 啟動中標志
最後一行加上:
attr_reader :enemy # 敵人
如果不加就會有BUG。
再在Window_Base里加上:
def get(str)
return self.contents.text_size(str).width
end
Scene_Map里加上:
attr_reader :spriteset
召喚界面腳本DemonsTap.attk(self_event)
他會自動關閉的。
2、
攻:$data_enemies[怪物編號].atk=值
防:$data_enemies[怪物編號].pdef=值
血(一般用不著):$data_enemies[怪物編號].maxhp=值
自行更改。

❷ Prg編程魔塔:敵方可以設置特殊魔法嗎

恩,可以的。

❸ pascal編程語言 編一個魔塔游戲

http://tieba..com/p/2254936209
誰說做不出來的。。這是我寫的,暫時沒寫完,不過已經能玩到33層了

❹ 問一個做魔塔的問題

這個,比較麻煩,建議LZ不要採用這種方法,這樣的魔塔以個人角度來說算是比較次的魔塔了,除非LZ是做魔塔迷宮,這樣或許還有趣味。

要這樣也可以:
首先打開資料庫,選擇公共事件0017:每層的並行處理內容,在:
條件分歧:開關【0046:進入漆黑世界】==NO 這一行的前面加上:

條件分歧:開關【一個空的開關,比如:9999:全部樓層變黑】==NO
開關操作:【0046:進入漆黑世界】==NO

除此以外的場合
開關操作:【0046:進入漆黑世界】==OFF

分歧結束

這個分歧後,在你要讓全部樓層變黑的事件上打開這個你剛才設置的新開關,然後在你要讓全部樓層變亮的事件上關閉這個開關,就行了。

你明白了嗎?不信可以試試,有問題來找我啦。

❺ @@會魔塔製作的高手請進,答對追加50分@@

1.腳本:▲Scene_Title
這裡面的紫色字體也就是我們可以改的地方。有幾行是:
#
生成命令窗口
s1
=
"新游戲"
s2
=
"繼續"
s3
=
"退出"
S1後面引號是開始游戲選擇的時候出現的文字,可以改一下,S2、S3以此類推。
確定後按F12游戲測試
2.腳本:▲Scene_Menu
裡面有如下幾行:
#
生成命令窗口
#
s1
=
$data_system.words.item
#
s2
=
$data_system.words.skill
#
s3
=
$data_system.words.equip
#
s4
=
"狀態"
s1
=
"敵物資料"
s2
=
"使用物品"
s3
=
"存檔"
s4
=
"讀檔"
s5
=
"重新開始"
s6
=
"結束游戲"
前面不帶#的S1~S6後面的文字可以改變,也就是游戲時按ESC開啟畫面的時候左邊的一行了。
3.腳本:▲Scene_Save
裡面的這幾行
#--------------------------------------------------------------------------
#

初始化對像
#--------------------------------------------------------------------------
def
initialize
super("要保存到這個文件嗎?")
SUPER後括弧中引號裡面的「要保存到這個文件么?」是可以改的,存檔的時候上面寫的字就是改後的文字。
4(兩個腳本連說)腳本:①▲Scene_Load②■Scene_Load2
這兩個腳本非常相似,一個是按ESC之後的讀檔顯示文字,另一個是開始界面讀取進度的文字,到底哪個是哪個我搞不清楚,先看代碼:
#--------------------------------------------------------------------------
#

初始化對像
#--------------------------------------------------------------------------
def
initialize
#
再生成臨時對像
$game_temp
=
Game_Temp.new
#
選擇存檔時間最新的文件
$game_temp.last_file_index
=
0
latest_time
=
Time.at(0)
for
i
in
0..3
filename
=
make_filename(i)
if
FileTest.exist?(filename)
file
=
File.open(filename,
"r")
if
file.mtime
>
latest_time
latest_time
=
file.mtime
$game_temp.last_file_index
=
i
end
file.close
end
end
super("要載入哪個文件?")
end
SUPER後「要載入哪個文件?」是要改的,與存檔近似。
@@@@@最重要的@@@@@
5.腳本:■Window_PlayerDate
這個腳本應該是最有用的,顯示了玩游戲的時候左面的攻擊防禦等一系列東西!腳本也要復制很長,所以我分開來講:
self.contents.font.color
=
text_color(3)
#
self.contents.draw_text(4,
0,
70,
45,
"第",
2)
self.contents.draw_text(4,
0,
125,
45,
"層",
2)
這一段代碼,是最前面顯示XX層的界面,如果想在前面加上「第」(也就是第XX層)的話就要把#符號去掉,如果想改變字體的顏色就要看前面的color後面小括弧里顯示的數字了,每一個數字代表的顏色都不同,一共有7個顏色,就是1~7,可以換顏色。
self.contents.draw_text(4,
0,
40,
142,
"等級",
2)
self.contents.draw_text(4,
0,
40,
208,
"生命",
2)
self.contents.draw_text(4,
0,
40,
263,
"攻擊",
2)
self.contents.draw_text(4,
0,
40,
318,
"防禦",
2)
self.contents.draw_text(4,
0,
40,
373,
"魔防",
2)
if
$game_switches[Playerdate_magicdef]
self.contents.draw_text(4,
0,
40,
439,
"經驗",
2)
self.contents.draw_text(4,
0,
40,
494,
"金幣",
2)
self.contents.font.color
=
text_color(6)
self.contents.draw_text(4,
0,
60,
576,
"黃鑰匙",
2)
self.contents.font.color
=
text_color(4)
self.contents.draw_text(4,
0,
60,
640,
"藍鑰匙",
2)
self.contents.font.color
=
text_color(2)
self.contents.draw_text(4,
0,
60,
704,
"紅鑰匙",
2)
這一段代碼,是顯示等級生命等東西的了,這裡面好多我都沒研究明白,以紅鑰匙那行的代碼來說,4,0,60,704中的704代表上下,如果輸入704以前的數字,「紅鑰匙」這三個字就會往上挪。不改變是正常的,要不就會里出外進了。如果要想等級一個顏色,生命一個顏色等,就要加腳本了,先給你們看加了顏色的代碼,再給你們講:
self.contents.font.color
=
text_color(1)
self.contents.draw_text(4,
0,
40,
142,
"等級",
2)
self.contents.font.color
=
text_color(2)
self.contents.draw_text(4,
0,
40,
208,
"生命",
2)
self.contents.font.color
=
text_color(3)
self.contents.draw_text(4,
0,
40,
263,
"攻擊",
2)
self.contents.font.color
=
text_color(4)
self.contents.draw_text(4,
0,
40,
318,
"防禦",
2)
self.contents.font.color
=
text_color(5)
self.contents.draw_text(4,
0,
40,
373,
"魔防",
2)
if
$game_switches[Playerdate_magicdef]
self.contents.font.color
=
text_color(6)
self.contents.draw_text(4,
0,
40,
439,
"經驗",
2)
self.contents.font.color
=
text_color(7)
self.contents.draw_text(4,
0,
40,
494,
"金幣",
2)
self.contents.font.color
=
text_color(6)
self.contents.draw_text(4,
0,
60,
576,
"黃鑰匙",
2)
self.contents.font.color
=
text_color(4)
self.contents.draw_text(4,
0,
60,
640,
"藍鑰匙",
2)
self.contents.font.color
=
text_color(2)
self.contents.draw_text(4,
0,
60,
704,
"紅鑰匙",
2)
self.contents.font.color
=
text_color(3)
self.contents.draw_text(4,
0,
60,
768,
"綠鑰匙",
2)
就是在每個代碼前面加了self.contents.font.color
=
text_color(n)(n代表顏色代碼)
就讓每個字活靈活現了~~如果沒改,將跟第XX層顯示的顏色一樣!
再繼續說:下一段代碼:
self.contents.font.color
=
text_color(3)
self.contents.draw_text(4,
0,
60,
770,
"中毒".to_s,
2)
if
$game_switches[13]
self.contents.font.color
=
text_color(5)
self.contents.draw_text(4,
0,
110,
770,
"衰弱".to_s,
2)
if
$game_switches[15]
self.contents.font.color
=
text_color(1)
self.contents.draw_text(4,
0,
60,
820,
"遲緩".to_s,
2)
if
$game_switches[12]
這就是中毒、衰弱、遲緩加到勇士身上後在左邊顯示的字了,如果不喜歡可以換哦!~~
6.腳本:■Window_EnemyDate
裡面有得到怪物手冊後可以顯示怪物資料的東西了(鏡子怪物在樣板0729中沒有,在0808樣板中有了)
self.contents.font.color
=
text_color(0)
@pro="普
通"
case
skill.maxsp
when
0
self.contents.font.color
=
text_color(0)
@pro="普
通"
when
1
self.contents.font.color
=
text_color(3)
@pro="中
毒"
when
2
self.contents.font.color
=
text_color(5)
@pro="衰
弱"
when
4
self.contents.font.color
=
text_color(2)
作者:
藕色貓
2006-8-13
18:26
回復此發言
--------------------------------------------------------------------------------
3
【分析】魔塔樣板腳本分析(絕對原創,申精)
@pro="吸
血"
@vampire=($game_actors[$game_variables[1]+1].hp*0.2).to_i
when
16
self.contents.font.color
=
text_color(11)
@pro="先
攻"
@first=1
when
32
self.contents.font.color
=
text_color(1)
@pro="遲
緩"
when
64
self.contents.font.color
=
text_color(12)
@pro="魔
攻"
@magicatk=@md
when
128
self.contents.font.color
=
text_color(6)
@pro=skill.eva.to_s+"連擊"
@turnatk=skill.eva
when
256
self.contents.font.color
=
text_color(4)
@pro="領
域"
when
512
self.contents.font.color
=
text_color(9)
@pro="爆
擊"
@edam=1.2
when
1024
self.contents.font.color
=
text_color(10)
@pro="隱
形"
when
2048
self.contents.font.color
=
text_color(8)
@pro="無
敵"
when
4096
self.contents.font.color
=
text_color(9)
@pro="削
血"
when
8192
self.contents.font.color
=
text_color(7)
@pro="鏡
子"
if
skill.atk<$game_actors[$game_variables[1]+1].str
skill.atk=($game_actors[$game_variables[1]+1].str).to_i
end#只有怪物基礎防禦小於勇士攻擊後才使它的防禦等於勇士攻擊-1
when
8
self.contents.font.color
=
text_color(4)
@pro="堅
固"
if
skill.pdef<$game_actors[$game_variables[1]+1].str
skill.pdef=($game_actors[$game_variables[1]+1].str+1).to_i
end#只有怪物基礎防禦小於勇士攻擊後才使它的防禦等於勇士攻擊-1
end
普通、中毒、衰弱、吸血、先攻、遲緩、魔攻、連擊、領域、暴擊、隱形、無敵、削血、鏡子、堅固。這些文字都可以改,比如在顛峰魔塔中就改了部分文字,領域改成怪異者……這些如果改了,在怪物屬性中也會顯示的到!
下一段代碼:
self.contents.draw_text(120,
y,
a,
32,
"生命",
0)
self.contents.draw_text(230,
y,a,
32,
"攻擊",0)
self.contents.draw_text(340,
y,
a,
32,
"防禦",0)
self.contents.draw_text(230,
y+32,
a,
32,
"經驗",
0)
self.contents.draw_text(120,
y+32,a,
32,
"金幣",
0)
self.contents.draw_text(340,
y+32,
a,
32,
"損失",
0)
這上面千萬不要以為是你的生命攻擊防禦,而是怪物的,如果改一下會很好哦!在樣板0808中把金幣改成了魔塔幣,經驗改成經驗點,感覺不錯!
7.腳本:▲Window_Gold
這段腳本本來我不想說,因為做魔塔樣板的人都會把這個寫到裡面,如果改了,魔塔樣板的作者不會高興的!就是按ESC後的左下角的東西,樣板0729中顯示Ver0729
,這些如果不徵求樣板作者同意不要改,除非在魔塔中繪制了樣板資料。
#--------------------------------------------------------------------------
#

刷新
#--------------------------------------------------------------------------
def
refresh
self.contents.clear
self.contents.font.color
=
system_color
self.contents.draw_text(0,
0,
130,
32,
"Ver0816",
1)
end
end
這段代碼中「Ver0816」(0816是我最近要弄的樣板)是可以改的,在顛峰魔塔中就改成顛峰魔塔,如果字多了會發現字體小了,不好看!
8.腳本:Window_PlayTime
裡面顯示的是游戲時間的腳本,腳本部分代碼如下:
#--------------------------------------------------------------------------
#

刷新
#--------------------------------------------------------------------------
def
refresh
self.contents.clear
self.contents.font.color
=
system_color
self.contents.draw_text(4,
0,
120,
32,
"游戲時間")
游戲時間是可以改的,最好是4個字的,要不字會小,可以改成追憶時間,回憶時間等
9.腳本:Window_Steps
顯示的是走過的步數,代碼如下:
#--------------------------------------------------------------------------
#

刷新
#--------------------------------------------------------------------------
def
refresh
self.contents.clear
self.contents.font.color
=
system_color
self.contents.draw_text(4,
0,
120,
32,
"步數")
步數是可以改的,我就不多說了。

❻ Prg編程魔塔:多跳層設置會搞亂整個程序的進程嗎

不會的,但要小心一點,我不容易啊,給我分把

熱點內容
什麼是程序存儲器 發布:2025-02-08 01:05:01 瀏覽:313
解壓包手機安裝 發布:2025-02-08 00:49:29 瀏覽:960
詹雯婷訪問 發布:2025-02-08 00:42:02 瀏覽:309
php無限分類樹 發布:2025-02-08 00:42:01 瀏覽:814
clang編譯命令 發布:2025-02-08 00:41:24 瀏覽:127
數據結構c語言版演算法 發布:2025-02-08 00:28:19 瀏覽:663
python環境管理 發布:2025-02-08 00:26:51 瀏覽:999
個人簡歷源碼 發布:2025-02-08 00:26:43 瀏覽:14
html5canvas上傳圖片 發布:2025-02-08 00:20:44 瀏覽:169
安卓輸入法哪個詞庫好 發布:2025-02-08 00:03:47 瀏覽:92