circular tim
This commit is contained in:
parent
bf96dbb46a
commit
885652082d
BIN
res/graphics/tim.ase
(Stored with Git LFS)
BIN
res/graphics/tim.ase
(Stored with Git LFS)
Binary file not shown.
169
src/sim_step.c
169
src/sim_step.c
@ -51,84 +51,6 @@ void sim_accel_reset(struct sim_snapshot *ss, struct sim_accel *accel)
|
|||||||
|
|
||||||
/* TODO: Remove this */
|
/* TODO: Remove this */
|
||||||
|
|
||||||
INTERNAL void spawn_test_entities(struct sim_step_ctx *ctx, struct v2 offset)
|
|
||||||
{
|
|
||||||
struct sim_snapshot *world = ctx->world;
|
|
||||||
struct sim_ent *root = sim_ent_from_id(world, SIM_ENT_ROOT_ID);
|
|
||||||
|
|
||||||
root->mass_unscaled = F32_INFINITY;
|
|
||||||
root->inertia_unscaled = F32_INFINITY;
|
|
||||||
|
|
||||||
/* Enemy */
|
|
||||||
if (ctx->is_master) {
|
|
||||||
struct sim_ent *e = sim_ent_alloc_sync_src(root);
|
|
||||||
|
|
||||||
struct v2 pos = V2(1, -2);
|
|
||||||
pos = v2_add(pos, offset);
|
|
||||||
f32 r = 0;
|
|
||||||
struct v2 size = V2(1, 1);
|
|
||||||
struct xform xf = XFORM_TRS(.t = pos, .r = r, .s = size);
|
|
||||||
sim_ent_set_xform(e, xf);
|
|
||||||
|
|
||||||
e->sprite = sprite_tag_from_path(LIT("res/graphics/tim.ase"));
|
|
||||||
e->sprite_collider_slice = LIT("shape");
|
|
||||||
e->layer = SIM_LAYER_SHOULDERS;
|
|
||||||
|
|
||||||
sim_ent_enable_prop(e, SIM_ENT_PROP_PHYSICAL_DYNAMIC);
|
|
||||||
e->mass_unscaled = 100;
|
|
||||||
e->inertia_unscaled = 10;
|
|
||||||
e->linear_ground_friction = 250;
|
|
||||||
e->angular_ground_friction = 200;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Big box */
|
|
||||||
#if 1
|
|
||||||
{
|
|
||||||
struct sim_ent *e = sim_ent_alloc_local(root);
|
|
||||||
|
|
||||||
struct v2 pos = V2(1, -0.5);
|
|
||||||
pos = v2_add(pos, offset);
|
|
||||||
f32 r = 0;
|
|
||||||
struct v2 size = V2(0.5, 0.25);
|
|
||||||
struct xform xf = XFORM_TRS(.t = pos, .r = r, .s = size);
|
|
||||||
sim_ent_set_xform(e, xf);
|
|
||||||
|
|
||||||
e->sprite = sprite_tag_from_path(LIT("res/graphics/box.ase"));
|
|
||||||
e->sprite_collider_slice = LIT("shape");
|
|
||||||
e->layer = SIM_LAYER_SHOULDERS;
|
|
||||||
|
|
||||||
sim_ent_enable_prop(e, SIM_ENT_PROP_PHYSICAL_DYNAMIC);
|
|
||||||
e->mass_unscaled = 100;
|
|
||||||
e->inertia_unscaled = 50;
|
|
||||||
e->linear_ground_friction = 100;
|
|
||||||
e->angular_ground_friction = 50;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Tiny box */
|
|
||||||
#if 0
|
|
||||||
{
|
|
||||||
struct sim_ent *e = sim_ent_alloc_sync_src(root);
|
|
||||||
|
|
||||||
struct v2 pos = V2(1, -0.5);
|
|
||||||
pos = v2_add(pos, offset);
|
|
||||||
f32 r = PI / 4;
|
|
||||||
struct v2 size = V2(0.5, 0.25);
|
|
||||||
struct xform xf = XFORM_TRS(.t = pos, .r = r, .s = size);
|
|
||||||
sim_ent_set_xform(e, xf);
|
|
||||||
|
|
||||||
e->sprite = sprite_tag_from_path(LIT("res/graphics/bullet.ase"));
|
|
||||||
e->sprite_collider_slice = LIT("shape");
|
|
||||||
e->layer = SIM_LAYER_SHOULDERS;
|
|
||||||
|
|
||||||
sim_ent_enable_prop(e, SIM_ENT_PROP_PHYSICAL_DYNAMIC);
|
|
||||||
e->mass_unscaled = 0.5;
|
|
||||||
e->inertia_unscaled = 1000;
|
|
||||||
e->linear_ground_friction = 0.001;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
INTERNAL struct sim_ent *spawn_test_employee(struct sim_step_ctx *ctx)
|
INTERNAL struct sim_ent *spawn_test_employee(struct sim_step_ctx *ctx)
|
||||||
{
|
{
|
||||||
struct sim_snapshot *world = ctx->world;
|
struct sim_snapshot *world = ctx->world;
|
||||||
@ -165,7 +87,7 @@ INTERNAL struct sim_ent *spawn_test_employee(struct sim_step_ctx *ctx)
|
|||||||
|
|
||||||
e->local_collider.points[0] = V2(0, 0);
|
e->local_collider.points[0] = V2(0, 0);
|
||||||
e->local_collider.count = 1;
|
e->local_collider.count = 1;
|
||||||
e->local_collider.radius = 0.30f;
|
e->local_collider.radius = 0.25f;
|
||||||
|
|
||||||
struct xform xf = XFORM_TRS(.t = pos, .r = r, .s = size);
|
struct xform xf = XFORM_TRS(.t = pos, .r = r, .s = size);
|
||||||
//xf.bx.y = -1.f;
|
//xf.bx.y = -1.f;
|
||||||
@ -179,7 +101,7 @@ INTERNAL struct sim_ent *spawn_test_employee(struct sim_step_ctx *ctx)
|
|||||||
|
|
||||||
//e->control_force = 500;
|
//e->control_force = 500;
|
||||||
e->control_force = 1200;
|
e->control_force = 1200;
|
||||||
e->control_force_max_speed = 8;
|
e->control_force_max_speed = 7;
|
||||||
|
|
||||||
//e->control_torque = 5000;
|
//e->control_torque = 5000;
|
||||||
e->control_torque = F32_INFINITY;
|
e->control_torque = F32_INFINITY;
|
||||||
@ -229,6 +151,93 @@ INTERNAL struct sim_ent *spawn_test_camera(struct sim_snapshot *world, struct si
|
|||||||
return camera_ent;
|
return camera_ent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
INTERNAL void spawn_test_entities(struct sim_step_ctx *ctx, struct v2 offset)
|
||||||
|
{
|
||||||
|
struct sim_snapshot *world = ctx->world;
|
||||||
|
struct sim_ent *root = sim_ent_from_id(world, SIM_ENT_ROOT_ID);
|
||||||
|
(UNUSED)offset;
|
||||||
|
|
||||||
|
root->mass_unscaled = F32_INFINITY;
|
||||||
|
root->inertia_unscaled = F32_INFINITY;
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
/* Enemy */
|
||||||
|
if (ctx->is_master) {
|
||||||
|
struct sim_ent *e = sim_ent_alloc_sync_src(root);
|
||||||
|
|
||||||
|
struct v2 pos = V2(1, -2);
|
||||||
|
pos = v2_add(pos, offset);
|
||||||
|
f32 r = 0;
|
||||||
|
struct v2 size = V2(1, 1);
|
||||||
|
struct xform xf = XFORM_TRS(.t = pos, .r = r, .s = size);
|
||||||
|
sim_ent_set_xform(e, xf);
|
||||||
|
|
||||||
|
e->sprite = sprite_tag_from_path(LIT("res/graphics/tim.ase"));
|
||||||
|
e->sprite_collider_slice = LIT("shape");
|
||||||
|
e->layer = SIM_LAYER_SHOULDERS;
|
||||||
|
|
||||||
|
sim_ent_enable_prop(e, SIM_ENT_PROP_PHYSICAL_DYNAMIC);
|
||||||
|
e->mass_unscaled = 100;
|
||||||
|
e->inertia_unscaled = 10;
|
||||||
|
e->linear_ground_friction = 250;
|
||||||
|
e->angular_ground_friction = 200;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Enemy */
|
||||||
|
if (ctx->is_master) {
|
||||||
|
struct sim_ent *e = spawn_test_employee(ctx);
|
||||||
|
(UNUSED)e;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Big box */
|
||||||
|
#if 0
|
||||||
|
{
|
||||||
|
struct sim_ent *e = sim_ent_alloc_local(root);
|
||||||
|
|
||||||
|
struct v2 pos = V2(1, -0.5);
|
||||||
|
pos = v2_add(pos, offset);
|
||||||
|
f32 r = 0;
|
||||||
|
struct v2 size = V2(0.5, 0.25);
|
||||||
|
struct xform xf = XFORM_TRS(.t = pos, .r = r, .s = size);
|
||||||
|
sim_ent_set_xform(e, xf);
|
||||||
|
|
||||||
|
e->sprite = sprite_tag_from_path(LIT("res/graphics/box.ase"));
|
||||||
|
e->sprite_collider_slice = LIT("shape");
|
||||||
|
e->layer = SIM_LAYER_SHOULDERS;
|
||||||
|
|
||||||
|
sim_ent_enable_prop(e, SIM_ENT_PROP_PHYSICAL_DYNAMIC);
|
||||||
|
e->mass_unscaled = 100;
|
||||||
|
e->inertia_unscaled = 50;
|
||||||
|
e->linear_ground_friction = 100;
|
||||||
|
e->angular_ground_friction = 50;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Tiny box */
|
||||||
|
#if 0
|
||||||
|
{
|
||||||
|
struct sim_ent *e = sim_ent_alloc_sync_src(root);
|
||||||
|
|
||||||
|
struct v2 pos = V2(1, -0.5);
|
||||||
|
pos = v2_add(pos, offset);
|
||||||
|
f32 r = PI / 4;
|
||||||
|
struct v2 size = V2(0.5, 0.25);
|
||||||
|
struct xform xf = XFORM_TRS(.t = pos, .r = r, .s = size);
|
||||||
|
sim_ent_set_xform(e, xf);
|
||||||
|
|
||||||
|
e->sprite = sprite_tag_from_path(LIT("res/graphics/bullet.ase"));
|
||||||
|
e->sprite_collider_slice = LIT("shape");
|
||||||
|
e->layer = SIM_LAYER_SHOULDERS;
|
||||||
|
|
||||||
|
sim_ent_enable_prop(e, SIM_ENT_PROP_PHYSICAL_DYNAMIC);
|
||||||
|
e->mass_unscaled = 0.5;
|
||||||
|
e->inertia_unscaled = 1000;
|
||||||
|
e->linear_ground_friction = 0.001;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
INTERNAL void test_clear_level(struct sim_step_ctx *ctx)
|
INTERNAL void test_clear_level(struct sim_step_ctx *ctx)
|
||||||
{
|
{
|
||||||
struct sim_snapshot *world = ctx->world;
|
struct sim_snapshot *world = ctx->world;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user