Adding a good friction

This commit is contained in:
AnonymusRaccoon
2020-01-06 16:22:12 +01:00
parent 5ed1fb5ec0
commit 2c6a60f7c1
6 changed files with 25 additions and 19 deletions
+3
View File
@@ -57,6 +57,7 @@
<Rect height="auto" width="auto" top="0" left="0" />
</renderer>
<collision_component layer="11000000" />
<friction_giver value=".7" />
</gc_entity>
<gc_entity>
<transform_component>
@@ -67,6 +68,7 @@
<Rect height="auto" width="auto" top="0" left="0" />
</renderer>
<collision_component layer="11000000" />
<friction_giver value=".7" />
</gc_entity>
<gc_entity>
<transform_component>
@@ -77,6 +79,7 @@
<Rect height="auto" width="auto" top="0" left="0" />
</renderer>
<collision_component layer="11000000" />
<friction_giver value=".7" />
</gc_entity>
</gc_entities>
</gc_scene>
+1 -1
View File
@@ -13,7 +13,7 @@
<keyboard_controller left="16" right="3" jump="57" />
<walk_action acceleration="3000" max_acceleration="100" decceleration="100"/>
<jump_action acceleration="25000" counterforce="6000"/>
<friction_component value=".7" />
<collision_component layer="11000000" />
<friction_component value=".5" />
</gc_entity>
</gc_entities>
+9 -8
View File
@@ -11,7 +11,7 @@
#include "utility.h"
#include <stdlib.h>
static void gravity_ctr(void *component, va_list args)
static void ctr(void *component, va_list args)
{
struct gravity_component *cmp = (struct gravity_component *)component;
@@ -19,21 +19,22 @@ static void gravity_ctr(void *component, va_list args)
cmp->max_speed = va_arg(args, int);
}
static void gravity_fdctr(gc_scene *scene, void *component, node *n)
static void fdctr(gc_entity *entity, gc_scene *scene, void *component, node *n)
{
struct gravity_component *cmp = (struct gravity_component *)component;
cmp->gravity_speed = xml_getintprop(n, "speed");
cmp->max_speed = xml_getintprop(n, "max_speed");
(void)scene;
(void)entity;
}
static void gravity_dtr(void *component)
static void dtr(void *component)
{
(void)component;
}
static char *gravity_serialize(void *component)
static char *serialize(void *component)
{
(void)component;
return (NULL);
@@ -48,10 +49,10 @@ const struct gravity_component gravity_component = {
"transform_component",
NULL
},
ctr: &gravity_ctr,
fdctr: &gravity_fdctr,
dtr: &gravity_dtr,
serialize: &gravity_serialize,
ctr: &ctr,
fdctr: &fdctr,
dtr: &dtr,
serialize: &serialize,
destroy: &component_destroy
},
gravity_speed: 10
+2 -1
View File
@@ -20,7 +20,7 @@ static void ctr(void *component, va_list args)
cmp->contered = false;
}
static void fdctr(gc_scene *scene, void *component, node *n)
static void fdctr(gc_entity *entity, gc_scene *scene, void *component, node *n)
{
struct jump_action *cmp = (struct jump_action *)component;
@@ -28,6 +28,7 @@ static void fdctr(gc_scene *scene, void *component, node *n)
cmp->counterforce = xml_getintprop(n, "counterforce");
cmp->contered = false;
(void)scene;
(void)entity;
}
static void dtr(void *component)
+9 -8
View File
@@ -12,7 +12,7 @@
#include "utility.h"
#include <stdlib.h>
static void walk_ctr(void *component, va_list args)
static void ctr(void *component, va_list args)
{
struct walk_action *cmp = (struct walk_action *)component;
@@ -21,7 +21,7 @@ static void walk_ctr(void *component, va_list args)
cmp->decceleration = va_arg(args, int);
}
static void walk_fdctr(gc_scene *scene, void *component, node *n)
static void fdctr(gc_entity *entity, gc_scene *scene, void *component, node *n)
{
struct walk_action *cmp = (struct walk_action *)component;
@@ -29,14 +29,15 @@ static void walk_fdctr(gc_scene *scene, void *component, node *n)
cmp->max_acceleration = xml_getintprop(n, "max_acceleration");
cmp->decceleration = xml_getintprop(n, "decceleration");
(void)scene;
(void)entity;
}
static void walk_dtr(void *component)
static void dtr(void *component)
{
(void)component;
}
static char *walk_serialize(void *component)
static char *serialize(void *component)
{
(void)component;
return (NULL);
@@ -52,10 +53,10 @@ const struct walk_action walk_action = {
"transform_component",
NULL
},
ctr: &walk_ctr,
fdctr: &walk_fdctr,
dtr: &walk_dtr,
serialize: &walk_serialize,
ctr: &ctr,
fdctr: &fdctr,
dtr: &dtr,
serialize: &serialize,
destroy: &component_destroy
},
acceleration: 0,