• Erik Luo

The combat system in CONSUMER

This is the diagram of the system.

Here is what it looks like in game play:

Laser Part Creation:

In the Step event of body object:

fireRate = room_speed*global.FireRate;

maxPart = global.Range;

//Set values

with(id){//With this body object


while(partNumber < maxPart){//Create laser

partRight[partNumber] = instance_create_layer(x,y,"Instances",obj_laserRight);

partLeft[partNumber] = instance_create_layer(x,y,"Instances",obj_laserLeft);

//Set target as body object

partRight[partNumber].target = id;

partLeft[partNumber].target = id;

//Get the order number for the position

partRight[partNumber].orderNumber = partNumber;

partLeft[partNumber].orderNumber = partNumber;

if(partNumber == 0){

//Set image target as body object if is the first part in the list

partRight[partNumber].imageTarget = id;

partLeft[partNumber].imageTarget = id;

}else if(partNumber > 0){

//Set image target as the previous part object if is the first part in the list

partRight[partNumber].imageTarget = partRight[partNumber-1];

partLeft[partNumber].imageTarget = partRight[partNumber-1];






if(!mouse_check_button(mb_right)||global.currentEnergy <= 0){

//If mb_right is not pressed, rest the partNumber

if(global.charge <= 0 && global.charging == false){



}else if(mouse_check_button(mb_right)&&global.currentEnergy >= 0){



Laser Part Movement:

In Step Event:

//Run Movement Script


//Run Image Scale Script



imageDirection = point_direction(x,y,imageTarget.x,imageTarget.y);


image_angle = imageDirection;

In LaserMovement()

///@params angleOffSet,randomness,cameraTarget

var angleOffSet = argument[0];//Left is negative and right is positive

var randomness = argument[1];//1 to 50

var cameraTarget = argument[2];// Left or right


var angleMovement;

var angle;

var distance;

var direct;

if(global.angleMovementSpeed <= 0){

//If the laser is not rotating

angleMovement = angleOffSet;

//Just shoot the laser


angleMovement += angleOffSet-global.angleMovementSpeed;

//Rotate the laser by its movement speed


//if the laser hits an enemy and sets a target


&&obj_camera.target != obj_head1

&&cameraTarget!= obj_head1

&&cameraTarget != noone){

direct = point_direction(target.x,target.y,obj_cameraTarget.target.x,obj_cameraTarget.target.y);

if(orderNumber > 1){//if the current laser is in the far end of the laser

//Move randomly within range

angle = target.image_angle-random_range(angleMovement- randomness,angleMovement+randomness);

//move at normal angle


angle = target.image_angle-angleMovement;

//Move without randomness



distance = global.DistanceBetweenParts * orderNumber;

//set distance between parts


//move the laser objects around the target


instance_destroy(id);//If the body doesn't exist, self destroy


In rotate_around_point()


var obj = argument[0];

var xx = argument[1];

var yy = argument[2];

var angle = argument[3];

var distance = argument[4];

var _speed = argument[5];

var _xx = xx+lengthdir_x(1,angle)*distance;

// player.x + the point at distance 1, on an angle * distance which give the point at Distance on angle relative to the player

var _yy = yy+lengthdir_y(1,angle)*distance;

obj.x = lerp(obj.x,_xx,_speed);

//Find the number between player.x and final x with the amount of Speed.

obj.y = lerp(obj.y,_yy,_speed);

Erik Luo

Game Designer

VR/MR Developer



©2017 BY ERIK LUO.