4
« on: February 19, 2015, 05:14:32 AM »
Can't figure it out. The below code is almost identical to the example in the conveyor module, but when ran I receive the error "the index 'rawset_index_offset' does not exist"
fe.load_module( "conveyor" );
class Card extends ConveyorSlot {
m_parent = null;
constructor( parent, text ) {
m_parent = parent;
base.constructor( ::fe.add_text( text, 0, 0, 0, 0 ) );
}
function on_progress( progress, var ) {
m_obj.set_rgb( 255, 0, 0 );
m_obj.width = m_parent.m_width;
m_obj.height = m_parent.m_height;
m_obj.x = m_parent.m_x + progress * m_parent.m_x_span;
m_obj.y = m_parent.m_y + progress * m_parent.m_y_span;
}
};
class Cards extends Conveyor {
m_x=0; m_y=0; m_width=0; m_height=0; m_x_span=0; m_y_span=0;
constructor( text, num_objs, x, y, width, height, pad=0 ) {
base.constructor();
local my_list = [];
for ( local i=0; i<num_objs; i++ )
my_list.push( Card( this, text ) );
set_slots( my_list );
m_x=x+pad/2; m_y=y+pad/2;
m_x_span=width;
m_y_span=0;
m_width=width/m_objs.len()-pad;
m_height=height-pad;
reset_progress();
}
};
local cards = Cards( "test", 5, 0, 0, fe.layout.width,
25, 2 );