Skip to content

Commit

Permalink
Set up a crummy-but-working prototype of an object spawning damage hi…
Browse files Browse the repository at this point in the history
…tboxes in a beam orientation. Next, we need to conserve+reuse the hitbox objects rather than replacing them on every frame, and then we need to make this use the attache system so these can get attached to hittable parents.
  • Loading branch information
rkettering committed May 1, 2016
1 parent 6653dc5 commit 7c97102
Showing 1 changed file with 34 additions and 6 deletions.
40 changes: 34 additions & 6 deletions data/objects/effects/experimental/damage_beam_attache.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,17 @@
taxonomy: "'neutral'",
attack_damage: "int :: if(higher_difficulty, 2, 1)",
team: "string :: 'evil'",
has_mini_hp_bar: "bool :: false",


beam_angle: "decimal :: 60.0",
beam_angle: { type: "decimal", init: "60.0" },
beam_distance: "decimal :: 180.0",
attack_diameter: "decimal :: 40.0",
attack_radius: "decimal :: lib.math.round( attack_diameter / 2 )",
attack_radius: "decimal :: lib.math.round( attack_diameter / 2.0 )",
hitbox_count: "decimal :: lib.math.ceil(beam_distance / (attack_radius / 1.0))",

cartesian_multiplier: "{ x: decimal, y: decimal } :: { x: cos(beam_angle), y: sin(beam_angle) }",

offset: "{ x: decimal, y: decimal } :: { x: length * cos(beam_angle), y: length * sin(beam_angle) } where length = (beam_distance / hitbox_count)",

hitbox_animation: "map :: {
id: 'image',
Expand All @@ -34,11 +38,35 @@
attack_area: [-attack_radius, -attack_radius, attack_radius, attack_radius, 'solid'],
}",


set_hitboxes: "commands :: [
set(animation, hitbox_animation),
map( range(1, hitbox_count),
spawn('damage_beam_attache.hitbox_object', x,y, {facing: facing, mid_x: mid_x + (offset.x * value), mid_y: mid_y + (offset.y * value), animation: hitbox_animation}) )
]"
},

on_create: "[set(animation, hitbox_animation)]",
on_process: "[set_hitboxes, add(beam_angle, 1)]",

on_process: "set(animation, hitbox_animation)",
on_create: "set_hitboxes",

object_type: [
{
id: "hitbox_object",
always_active: true,
serializable: false,

on_create: "schedule(2, die())",
prototype: ["hittable"],

properties: {
taxonomy: "'neutral'",
attack_damage: "int :: if(higher_difficulty, 2, 1)",
team: "string :: 'evil'",
has_mini_hp_bar: "bool :: false",


}
}
],

}

0 comments on commit 7c97102

Please sign in to comment.