projects
/
ld42_outofspace
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
31858c8
)
looks more fun when increasing the pull of gravity
author
John Tsiombikas
<nuclear@member.fsf.org>
Tue, 14 Aug 2018 03:27:04 +0000
(06:27 +0300)
committer
John Tsiombikas
<nuclear@member.fsf.org>
Tue, 14 Aug 2018 03:27:04 +0000
(06:27 +0300)
src/gamescr.cc
patch
|
blob
|
history
diff --git
a/src/gamescr.cc
b/src/gamescr.cc
index
abd7865
..
638032c
100644
(file)
--- a/
src/gamescr.cc
+++ b/
src/gamescr.cc
@@
-68,6
+68,9
@@
struct QuadMesh {
#define CONTRIB_THRES 0.005
#define CONTRIB_RANGE(m) sqrt((m) / CONTRIB_THRES)
#define CONTRIB_THRES 0.005
#define CONTRIB_RANGE(m) sqrt((m) / CONTRIB_THRES)
+/* gravitational strength */
+#define GRAV_STR 16.0f
+
static int pos_to_grid(float x, float y);
static Vec2 grid_to_pos(int gx, int gy);
static int pos_to_grid(float x, float y);
static Vec2 grid_to_pos(int gx, int gy);
@@
-177,7
+180,7
@@
static void simstep()
while(p) {
// calculate the field gradient at the particle position
int gidx = pos_to_grid(p->pos.x, p->pos.y);
while(p) {
// calculate the field gradient at the particle position
int gidx = pos_to_grid(p->pos.x, p->pos.y);
- Vec2 grad = calc_field_grad(gidx);
+ Vec2 grad = calc_field_grad(gidx) * GRAV_STR;
p->vel += grad * SIM_DT;
p->pos += p->vel * SIM_DT;
p->vel += grad * SIM_DT;
p->pos += p->vel * SIM_DT;
@@
-291,7
+294,7
@@
static void update()
em->pos = emit_place_pos;
em->mass = 100;
em->rate = 10;
em->pos = emit_place_pos;
em->mass = 100;
em->rate = 10;
- em->chunk = 0.01 * em->mass;
+ em->chunk = 0.001 * em->mass;
em->angle = -1;
em->spread = 0;
em->spawn_pending = 0;
em->angle = -1;
em->spread = 0;
em->spawn_pending = 0;