init
This commit is contained in:
commit
0556f63d2d
119 changed files with 2908 additions and 0 deletions
236
objects/obspaceship/Step_0.gml
Normal file
236
objects/obspaceship/Step_0.gml
Normal file
|
|
@ -0,0 +1,236 @@
|
|||
destAngle = point_direction(x, y, obCursor.x, obCursor.y);
|
||||
|
||||
if direction != destAngle //ограниченный поворот
|
||||
{
|
||||
if global.movementType = 0
|
||||
{
|
||||
if angle_difference(destAngle, direction)<0
|
||||
{
|
||||
direction -= shipTurnRate/room_speed;
|
||||
}
|
||||
else
|
||||
{
|
||||
direction += shipTurnRate/room_speed;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if keyboard_check(global.bindTurnLeft)
|
||||
{
|
||||
direction += shipTurnRate/room_speed;
|
||||
}
|
||||
if keyboard_check(global.bindTurnRight)
|
||||
{
|
||||
direction -= shipTurnRate/room_speed;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
direction = destAngle;
|
||||
}
|
||||
|
||||
image_angle = direction;
|
||||
|
||||
speed = shipSpeed;
|
||||
|
||||
if keyboard_check(global.bindAccelerate) //ускорение
|
||||
{
|
||||
if shipSpeed < shipSpeedUpCap and !turbo
|
||||
{
|
||||
shipSpeed += shipAccel/room_speed;
|
||||
}
|
||||
else
|
||||
{
|
||||
shipSpeed = shipSpeedUpCap;
|
||||
}
|
||||
}
|
||||
|
||||
if keyboard_check(global.bindDeaccelerate) //торможение
|
||||
{
|
||||
if shipSpeed > shipSpeedDownCap
|
||||
{
|
||||
shipSpeed -= shipAccel/room_speed;
|
||||
}
|
||||
else
|
||||
{
|
||||
shipSpeed = shipSpeedDownCap;
|
||||
}
|
||||
}
|
||||
|
||||
if !inMenu and (keyboard_check_pressed(global.bindFire) or mouse_check_button_pressed(mb_right)) and alarm[4] = -1
|
||||
{
|
||||
switch secondaryWeapon.weapontype
|
||||
{
|
||||
case weaponType.rocket:
|
||||
if rockets > 0 //ракеты
|
||||
{
|
||||
lat = point_direction(x, y, obCursor.x, obCursor.y);
|
||||
lenX = lengthdir_x(rocketLen, lat + rocketDir);
|
||||
lenY = lengthdir_y(rocketLen, lat + rocketDir);
|
||||
rocket = instance_create_layer(x + lenX, y + lenY, "Instances", obRocket);
|
||||
rocket.direction = direction;
|
||||
rocket.owner = obSpaceship;
|
||||
rocket.damage = secondaryWeapon.damage;
|
||||
rocket.rocketTurnRate = secondaryWeapon.rotationspeed;
|
||||
rocket.speed = secondaryWeapon.projspeed;
|
||||
rockets--;
|
||||
alarm[4] = room_speed / secondaryWeapon.firerate;
|
||||
}
|
||||
break;
|
||||
case weaponType.laser: //лазеры
|
||||
lat = point_direction(x, y, obCursor.x, obCursor.y);
|
||||
lenX = lengthdir_x(rocketLen, lat + rocketDir);
|
||||
lenY = lengthdir_y(rocketLen, lat + rocketDir);
|
||||
laser = instance_create_layer(x + lenX, y + lenY, "Instances", obLaser);
|
||||
laser.direction = direction;
|
||||
laser.owner = obSpaceship;
|
||||
laser.damage = secondaryWeapon.damage;
|
||||
laser.speed = secondaryWeapon.projspeed;
|
||||
alarm[4] = room_speed / secondaryWeapon.firerate;
|
||||
}
|
||||
}
|
||||
|
||||
if !inMenu and mouse_check_button(mb_left) and alarm[0] = -1
|
||||
{
|
||||
switch primaryWeapon.weapontype
|
||||
{
|
||||
case weaponType.rocket:
|
||||
if rockets > 0 //ракеты
|
||||
{
|
||||
lat = point_direction(x, y, obCursor.x, obCursor.y);
|
||||
lenX = lengthdir_x(rocketLen, lat + rocketDir);
|
||||
lenY = lengthdir_y(rocketLen, lat + rocketDir);
|
||||
rocket = instance_create_layer(x + lenX, y + lenY, "Instances", obRocket);
|
||||
rocket.direction = direction;
|
||||
rocket.owner = obSpaceship;
|
||||
rocket.damage = primaryWeapon.damage;
|
||||
rocket.rocketTurnRate = primaryWeapon.rotationspeed;
|
||||
rocket.speed = primaryWeapon.projspeed;
|
||||
rockets--;
|
||||
alarm[0] = room_speed / primaryWeapon.firerate;
|
||||
}
|
||||
break;
|
||||
case weaponType.laser: //лазеры
|
||||
lat = point_direction(x, y, obCursor.x, obCursor.y);
|
||||
lenX = lengthdir_x(rocketLen, lat + rocketDir);
|
||||
lenY = lengthdir_y(rocketLen, lat + rocketDir);
|
||||
laser = instance_create_layer(x + lenX, y + lenY, "Instances", obLaser);
|
||||
laser.direction = direction;
|
||||
laser.owner = obSpaceship;
|
||||
laser.damage = primaryWeapon.damage;
|
||||
laser.speed = primaryWeapon.projspeed;
|
||||
alarm[0] = room_speed / primaryWeapon.firerate;
|
||||
}
|
||||
}
|
||||
|
||||
if place_meeting(x, y, obSpacestation)
|
||||
{
|
||||
x = xprevious - lengthdir_x(16, spacestationLocation);
|
||||
y = yprevious - lengthdir_y(16, spacestationLocation);
|
||||
alarm[1] = 1;
|
||||
if inMenu
|
||||
{
|
||||
shipSpeed = 0;
|
||||
}
|
||||
}
|
||||
|
||||
spacestationLocation = point_direction(x, y, obSpacestation.x, obSpacestation.y);
|
||||
|
||||
with obSpacestationMenu
|
||||
{
|
||||
obSpaceship.inMenu = collision_circle(x, y, radius, obSpaceship, true, false);
|
||||
}
|
||||
|
||||
camX = camera_get_view_x(view_camera[0]);
|
||||
camY = camera_get_view_y(view_camera[0]);
|
||||
guiMouseX = device_mouse_x_to_gui(0);
|
||||
guiMouseY = device_mouse_y_to_gui(0);
|
||||
|
||||
if inMenu
|
||||
{
|
||||
if guiMouseX >= 132 and guiMouseX <= 252 and guiMouseY >= 131 and guiMouseY <= 159 and mouse_check_button_released(mb_left)
|
||||
{
|
||||
action = 1;
|
||||
alarm[3] = 1;
|
||||
}
|
||||
if guiMouseX >= 132 and guiMouseX <= 252 and guiMouseY >= 162 and guiMouseY <= 190 and mouse_check_button_released(mb_left)
|
||||
{
|
||||
action = 2;
|
||||
alarm[3] = 1;
|
||||
}
|
||||
if guiMouseX >= 132 and guiMouseX <= 252 and guiMouseY >= 193 and guiMouseY <= 221 and mouse_check_button_released(mb_left)
|
||||
{
|
||||
action = 3;
|
||||
alarm[3] = 1;
|
||||
}
|
||||
if guiMouseX >= 132 and guiMouseX <= 252 and guiMouseY >= 224 and guiMouseY <= 252 and mouse_check_button_released(mb_left)
|
||||
{
|
||||
action = 4;
|
||||
alarm[3] = 1;
|
||||
}
|
||||
|
||||
if guiMouseX >= 276 and guiMouseX <= 456 and guiMouseY >= 131 and guiMouseY <= 159 and mouse_check_button_released(mb_left)
|
||||
{
|
||||
action = 5;
|
||||
alarm[3] = 1;
|
||||
}
|
||||
if guiMouseX >= 276 and guiMouseX <= 456 and guiMouseY >= 162 and guiMouseY <= 190 and mouse_check_button_released(mb_left)
|
||||
{
|
||||
action = 6;
|
||||
alarm[3] = 1;
|
||||
}
|
||||
if guiMouseX >= 276 and guiMouseX <= 456 and guiMouseY >= 193 and guiMouseY <= 221 and mouse_check_button_released(mb_left)
|
||||
{
|
||||
action = 7;
|
||||
alarm[3] = 1;
|
||||
}
|
||||
if guiMouseX >= 276 and guiMouseX <= 456 and guiMouseY >= 224 and guiMouseY <= 252 and mouse_check_button_released(mb_left)
|
||||
{
|
||||
action = 8;
|
||||
alarm[3] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
if shipHealth <= 0
|
||||
{
|
||||
shipHealth = round(shipMaxHealth/2);
|
||||
shipSpeed = 0;
|
||||
alarm[2] = 1;
|
||||
}
|
||||
|
||||
if keyboard_check(global.bindTurbo) and shipTurboFuel > 0 and engine.shipTurbo
|
||||
{
|
||||
turbo = 1;
|
||||
shipTurboFuel--;
|
||||
shipSpeed = shipTurboSpeed;
|
||||
}
|
||||
else
|
||||
{
|
||||
turbo = 0;
|
||||
if shipSpeed > shipSpeedUpCap
|
||||
{
|
||||
shipSpeed = shipSpeedUpCap;
|
||||
}
|
||||
}
|
||||
|
||||
shipMaxHealth = shipType.shipHealth;
|
||||
shipSpeedUpCap = engine.shipSpeedUpCap;
|
||||
shipSpeedDownCap = engine.shipSpeedDownCap;
|
||||
shipTurboSpeed = engine.shipTurboSpeed;
|
||||
shipTurboFuelLimit = engine.shipTurboFuelLimit;
|
||||
|
||||
if shipTurboFuel > shipTurboFuelLimit
|
||||
{
|
||||
shipTurboFuel = shipTurboFuelLimit;
|
||||
}
|
||||
|
||||
if alarm[5] = -1 and shipShield < shield.shieldCapacity
|
||||
{
|
||||
shipShield += shield.shieldChargerate/room_speed;
|
||||
}
|
||||
|
||||
if shipShield > shield.shieldCapacity
|
||||
{
|
||||
shipShield = shield.shieldCapacity
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue