- Joined
- Mar 13, 2012
- Messages
- 1,311
- Reaction score
- 485
- First Language
- French
Hello,
Can someone help me check if this script is correctly coded, please ?
A friend tried to teach how to script months ago and this is the result.
But I'm unable at the moment to meet him.
The purpose of this script is to help me call a sprite from a sprite sheet and to change it to my taste through a script command in an event. Yes, I'm more an eventer than a scripter...
Can someone help me check if this script is correctly coded, please ?
A friend tried to teach how to script months ago and this is the result.
But I'm unable at the moment to meet him.
The purpose of this script is to help me call a sprite from a sprite sheet and to change it to my taste through a script command in an event. Yes, I'm more an eventer than a scripter...
Code:
class Chara < Game_Interpreter def initialize(id, type, nom, x=0, y=0, z=0, m) sprite = Sprite.new sprite.x = x sprite.y = y sprite.z = z sprite.mirror = m m = false chemin = "Graphics/Units/#{type}/#{nom}" sprite.bitmap = Cache.normal_bitmap(chemin) w = sprite.width/3 h = sprite.height/5 sprite.src_rect.set(0, 0, w, h) V[id] = sprite end def self.frame(id, frame) V[id].src_rect.x = frame*V[id].width end def self.pose (id, pose) V[id].src_rect.y = pose*V[id].height end def self.add(id, type, nom) chemin = "Graphics/Units/#{type}/#{nom}" bitmap = Cache.normal_bitmap(chemin) rect = Rect.new(0, 0, bitmap.width, bitmap.height) V[id].bitmap.blt(0, 0, bitmap, rect) end end
