怎么学好ruby

Python012

怎么学好ruby,第1张

LZ好,你如果想用rpgmaker自己弄游戏的话,最好自己先学好ruby语句,这样自己修改脚本就方便多了。 默认脚本是没有问题的,你不会的话最好别在里面乱改东西,因为有时候少一个字就不行了。你把脚本还原就ok

你拿这段正常的替换脚本编辑器倒数第7行的Scene_Battle 3

class Scene_Battle

def start_phase3

@phase = 3

@actor_index = -1

@active_battler = nil

phase3_next_actor

end

def phase3_next_actor

begin

if @active_battler != nil

@active_battler.blink = false

end

if @actor_index == $game_party.actors.size-1

start_phase4

return

end

@actor_index += 1

@active_battler = $game_party.actors[@actor_index]

@active_battler.blink = true

end until @active_battler.inputable?

phase3_setup_command_window

end

def phase3_prior_actor

begin

if @active_battler != nil

@active_battler.blink = false

end

if @actor_index == 0

start_phase2

return

end

@actor_index -= 1

@active_battler = $game_party.actors[@actor_index]

@active_battler.blink = true

end until @active_battler.inputable?

phase3_setup_command_window

end

def phase3_setup_command_window

@party_command_window.active = false

@party_command_window.visible = false

@actor_command_window.active = true

@actor_command_window.visible = true

@actor_command_window.x = @actor_index * 160

@actor_command_window.index = 0

end

def update_phase3

if @enemy_arrow != nil

update_phase3_enemy_select

elsif @actor_arrow != nil

update_phase3_actor_select

elsif @skill_window != nil

update_phase3_skill_select

elsif @item_window != nil

update_phase3_item_select

elsif @actor_command_window.active

update_phase3_basic_command

end

end

def update_phase3_basic_command

if Input.trigger?(Input::B)

$game_system.se_play($data_system.cancel_se)

phase3_prior_actor

return

end

if Input.trigger?(Input::C)

case @actor_command_window.index

when 0

$game_system.se_play($data_system.decision_se)

@active_battler.current_action.kind = 0

@active_battler.current_action.basic = 0

start_enemy_select

when 1

$game_system.se_play($data_system.decision_se)

@active_battler.current_action.kind = 1

start_skill_select

when 2

$game_system.se_play($data_system.decision_se)

@active_battler.current_action.kind = 0

@active_battler.current_action.basic = 1

phase3_next_actor

when 3

$game_system.se_play($data_system.decision_se)

@active_battler.current_action.kind = 2

start_item_select

end

return

end

end

def update_phase3_skill_select

@skill_window.visible = true

@skill_window.update

if Input.trigger?(Input::B)

$game_system.se_play($data_system.cancel_se)

end_skill_select

return

end

if Input.trigger?(Input::C)

@skill = @skill_window.skill

if @skill == nil or not @active_battler.skill_can_use?(@skill.id)

$game_system.se_play($data_system.buzzer_se)

return

end

$game_system.se_play($data_system.decision_se)

@active_battler.current_action.skill_id = @skill.id

@skill_window.visible = false

if @skill.scope == 1

start_enemy_select

elsif @skill.scope == 3 or @skill.scope == 5

start_actor_select

else

end_skill_select

phase3_next_actor

end

return

end

end

def update_phase3_item_select

@item_window.visible = true

@item_window.update

if Input.trigger?(Input::B)

$game_system.se_play($data_system.cancel_se)

end_item_select

return

end

if Input.trigger?(Input::C)

@item = @item_window.item

unless $game_party.item_can_use?(@item.id)

$game_system.se_play($data_system.buzzer_se)

return

end

$game_system.se_play($data_system.decision_se)

@active_battler.current_action.item_id = @item.id

@item_window.visible = false

if @item.scope == 1

start_enemy_select

elsif @item.scope == 3 or @item.scope == 5

start_actor_select

else

end_item_select

phase3_next_actor

end

return

end

end

def update_phase3_enemy_select

@enemy_arrow.update

if Input.trigger?(Input::B)

$game_system.se_play($data_system.cancel_se)

end_enemy_select

return

end

if Input.trigger?(Input::C)

$game_system.se_play($data_system.decision_se)

@active_battler.current_action.target_index = @enemy_arrow.index

end_enemy_select

if @skill_window != nil

end_skill_select

end

if @item_window != nil

end_item_select

end

phase3_next_actor

end

end

def update_phase3_actor_select

@actor_arrow.update

if Input.trigger?(Input::B)

$game_system.se_play($data_system.cancel_se)

end_actor_select

return

end

if Input.trigger?(Input::C)

$game_system.se_play($data_system.decision_se)

@active_battler.current_action.target_index = @actor_arrow.index

end_actor_select

if @skill_window != nil

end_skill_select

end

if @item_window != nil

end_item_select

end

phase3_next_actor

end

end

def start_enemy_select

@enemy_arrow = Arrow_Enemy.new(@spriteset.viewport1)

@enemy_arrow.help_window = @help_window

@actor_command_window.active = false

@actor_command_window.visible = false

end

def end_enemy_select

@enemy_arrow.dispose

@enemy_arrow = nil

if @actor_command_window.index == 0

@actor_command_window.active = true

@actor_command_window.visible = true

@help_window.visible = false

end

end

def start_actor_select

@actor_arrow = Arrow_Actor.new(@spriteset.viewport2)

@actor_arrow.index = @actor_index

@actor_arrow.help_window = @help_window

@actor_command_window.active = false

@actor_command_window.visible = false

end

def end_actor_select

@actor_arrow.dispose

@actor_arrow = nil

end

def start_skill_select

@skill_window = Window_Skill.new(@active_battler)

@skill_window.help_window = @help_window

@actor_command_window.active = false

@actor_command_window.visible = false

end

def end_skill_select

@skill_window.dispose

@skill_window = nil

@help_window.visible = false

@actor_command_window.active = true

@actor_command_window.visible = true

end

def start_item_select

@item_window = Window_Item.new

@item_window.help_window = @help_window

@actor_command_window.active = false

@actor_command_window.visible = false

end

def end_item_select

@item_window.dispose

@item_window = nil

@help_window.visible = false

@actor_command_window.active = true

@actor_command_window.visible = true

end

end 10866希望对你有帮助!

要熟悉编程范式,尤其是面向过程及面向对象这两种要广泛阅读,多用编译器及IDE(网上有许多免费的)练习编程。

选择一种编程语言。初学者一定要从主流语言开始学习,比如中级语言C和C++。这两种语言是任何一名合格、专业的程序员都必须掌握的,因为它们称得上是软件开发界的主流。

但是最好不要从高级语言开始学,如Java,因为这些语言对于初学者来说难度未免太高(高级语言可以以后再学,但是C语言和C++应该作为你的基础)。

然而对于完完全全的门外汉的来说,可能C和C++都有点困难,那么你也可以从Python开始学,这种语言被大家广泛认为是适合初学者的。

第一步把高等数学包括离散数学,数值分析学好,数学是编程的基础,是编程算法的源泉,算法是编程的灵魂.

第二步建议你先学VB,VB是可视化的编程工具,对出学者入门很都帮助.

第三步学习C语言,现在很多操作系统和编程语言都是C语言编写的,比如Windows,UNIX,Linex等操作系统.C++,JAVA等语言.重要的是要把C语言的指针和数组学好,切记!如果你的C语言的功底已经够深了,就学C++或JAVA.

第四步编程重要的不是编程语言,重要的是算法和思路,你还得学数据结构,操作系统基础,计算机系统知识,网络知识,多媒体知识,系统开发运行知识,数据库基础等等.

最简单的方法是报个培训班。这是最适合非科班、零基础的人的方法。不知道从哪里学起?没关系,有讲师手把手教你写HelloWorld;

不知道学有所成之后能做什么?没关系,缴费之前就会被告知编程是有着无尽的可能的一项有机会改变世界的能力,从而增强你对编程的信心、增强编程对你的吸引力;遇到调不出的BUG还可以和同学交流、向老师请教。除了需要几千块钱的培训费。

不想报班、我就是想挑战自己的学习能力怎么办?我工作/学习很忙没时间去参加培训班怎么办?没关系,网络上有很多免费的公开课随时欢迎你。

国内的网易、新浪都不错,英语不好的话还有中文字幕。语言的选择,建议从脚本语言开始,Perl/Python/Ruby都可以,随便选个你看的顺眼的就行。

为什么建议从脚本开始?因为它们学起来很快、很方便,用不了多长时间就能做很多有用的或者有趣的小工具了。再稍微了解点web编程,w3school是你不二的选择。