This commit is contained in:
Alexey 2024-10-31 17:39:35 +03:00
commit 0556f63d2d
119 changed files with 2908 additions and 0 deletions

View file

View file

@ -0,0 +1,16 @@
rocketSpeed = 10; //тек. скорость
rocketTurnRate = 180; //скорость поворота
destination = instance_create_layer(obCursor.x, obCursor.y, "Instances", obMarker); //точка назначения
destination.host = id;
destAngle = point_direction(x, y, destination.x, destination.y); //угол назначения
alarm[0] = 10;
lx = 0;
ly = 0;
damage = 5;
owner = obSpaceship;

View file

@ -0,0 +1,8 @@
if owner = obSpaceship
{
draw_sprite_ext(spRocket1, image_index, x, y, 1, 1, direction, global.playerColor, 1)
}
else
{
draw_sprite_ext(spRocket1, image_index, x, y, 1, 1, direction, global.faction2Color, 1)
}

View file

@ -0,0 +1,4 @@
if !instance_exists(destination)
{
instance_destroy();
}

View file

@ -0,0 +1,77 @@
if !instance_exists(destination) and alarm[0] = -1
{
destAngle = direction;
}
else if instance_exists(destination)
{
speed = rocketSpeed;
image_angle = direction;
if direction != destAngle //ограниченный поворот
{
if angle_difference(destAngle, direction) < 0
{
direction -= rocketTurnRate/room_speed;
}
else
{
direction += rocketTurnRate/room_speed;
}
}
else
{
direction = destAngle;
}
destAngle = point_direction(x, y, destination.x, destination.y);
if collision_line(x - 6 + lx, y + ly, x + 6 + lx, y + ly, obSpacestation, true, false) and alarm[0] = -1
{
instance_destroy(destination);
instance_destroy();
}
if collision_line(x - 6 + lx, y + ly, x + 6 + lx, y + ly, obEnemy, true, false) and alarm[0] = -1
{
instance_nearest(x, y, obEnemy).shipHealth -= damage;
instance_destroy();
}
if collision_line(x - 6 + lx, y + ly, x + 6 + lx, y + ly, obSpaceship, true, false) and alarm[0] = -1
{
if obSpaceship.shipShield >= damage
{
obSpaceship.shipShield -= damage;
obSpaceship.alarm[5] = obSpaceship.shield.shieldDelay * room_speed;
}
else if obSpaceship.shipShield < damage and obSpaceship.shield > 0
{
damage -= obSpaceship.shipShield;
obSpaceship.shipShield = 0;
obSpaceship.alarm[5] = obSpaceship.shield.shieldDelay * room_speed;
obSpaceship.shipHealth -= damage;
}
else
{
obSpaceship.shipHealth -= damage;
}
instance_destroy();
}
if collision_line(x - 6 + lx, y + ly, x + 6 + lx, y + ly, obRocket, true, true)
{
instance_destroy(destination);
instance_destroy(other);
instance_destroy();
}
lx = lengthdir_x(4, direction);
ly = lengthdir_y(4, direction);
}
if instance_exists(destination)
{
if destination.target = 0
{
rocketTurnRate++;
}
}

View file

@ -0,0 +1,40 @@
{
"resourceType": "GMObject",
"resourceVersion": "1.0",
"name": "obRocket",
"eventList": [
{"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":0,"eventType":0,"isDnD":false,},
{"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":0,"eventType":3,"isDnD":false,},
{"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":0,"eventType":2,"isDnD":false,},
{"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":0,"eventType":8,"isDnD":false,},
{"resourceType":"GMEvent","resourceVersion":"1.0","name":"","collisionObjectId":null,"eventNum":0,"eventType":7,"isDnD":false,},
],
"managed": true,
"overriddenProperties": [],
"parent": {
"name": "Objects",
"path": "folders/Objects.yy",
},
"parentObjectId": null,
"persistent": false,
"physicsAngularDamping": 0.1,
"physicsDensity": 0.5,
"physicsFriction": 0.2,
"physicsGroup": 1,
"physicsKinematic": false,
"physicsLinearDamping": 0.1,
"physicsObject": false,
"physicsRestitution": 0.1,
"physicsSensor": false,
"physicsShape": 1,
"physicsShapePoints": [],
"physicsStartAwake": true,
"properties": [],
"solid": false,
"spriteId": {
"name": "spRocket1",
"path": "sprites/spRocket1/spRocket1.yy",
},
"spriteMaskId": null,
"visible": true,
}