var this = instance_create(x, y, object);
this.attack = 15;
this.defense = 6;
this.image_xscale = image_xscale;
var this = instance_create(x, y, object);
with (this)
{
attack = 15;
defense = 6;
image_xscale = other.image_xscale;
}
TKS for your reply.Either use a dot operator or a with() statement
orCode:var this = instance_create(x, y, object); this.attack = 15; this.defense = 6; this.image_xscale = image_xscale;
This will be run after the create event of the just created instance.Code:var this = instance_create(x, y, object); with (this) { attack = 15; defense = 6; image_xscale = other.image_xscale; }
Then you have to do the initializing directly inside the with() statement.TKS for your reply.
But the argument is self-defined, and I want it be effected immediately in the create event.
Cause I used this argument to do sth. while intializing.
So the FlameLv as following is my intial argument for create the sub objects "FlameBody";Then you have to do the initializing directly inside the with() statement.
Can you show the create event for refrence?
FlameCenter = oFlameCenter;
FlameBody = oFlameBody;
FlameTail = oFlameTail;
Fw = sprite_get_width(FlameCenter);
Fh = sprite_get_height(FlameCenter);
MaxIndex = sprite_get_number(FlameCenter);
FlameLv = 20;
var _bias = 1;
//Center
InstFlameCenter = instance_create_depth(x,y,depth,FlameCenter);
//Body Here is "FlameLv"
InstFlameBodyArr = array_create(FlameLv*4,noone);
for( var i = 0; i<FlameLv; i++ ){
InstFlameBodyArr[0 + i*4] = instance_create_depth(x+(i+1)*Fw -_bias ,y,depth,FlameBody);
InstFlameBodyArr[1 + i*4] = instance_create_depth(x-(i+1)*Fw +_bias,y,depth,FlameBody);
InstFlameBodyArr[1 + i*4].image_angle = 180;
InstFlameBodyArr[2 + i*4] = instance_create_depth(x,y+(i+1)*Fh -_bias,depth,FlameBody);
InstFlameBodyArr[2 + i*4].image_angle = -90;
InstFlameBodyArr[3 + i*4] = instance_create_depth(x,y-(i+1)*Fh +_bias,depth,FlameBody);
InstFlameBodyArr[3 + i*4].image_angle = 90;
}
InstFlameTailArr = array_create(4);
InstFlameTailArr[0] = instance_create_depth(x+(FlameLv+1)*Fw -_bias,y,depth,FlameTail);
InstFlameTailArr[1] = instance_create_depth(x-(FlameLv+1)*Fw +_bias,y,depth,FlameTail);
InstFlameTailArr[1].image_angle = 180
InstFlameTailArr[2] = instance_create_depth(x,y+(FlameLv+1)*Fh -_bias,depth,FlameTail);
InstFlameTailArr[2].image_angle = -90;
InstFlameTailArr[3] = instance_create_depth(x,y-(FlameLv+1)*Fh +_bias,depth,FlameTail);
InstFlameTailArr[3].image_angle = 90;
with (instance_create(x, y, obj)) {
a_variable = some_value;
//.....
event_user(0);
}
/// @desc instance_create_args
/// @param x
/// @param y
/// @param layer
/// @param object
/// @param ...
var x = argument[0];
var y = argument[1];
var layer = argument[2];
var object = argument[3];
for (var i = 4; i < argument_count; i++)
{
global.create_param[i-4] = argument[i];
}
var instance = instance_create_layer(x, y, layer, object);
return instance;