Posted By: cartoon_baboon
AUM 46 morrowing player movement - 03/15/09 18:45
Hi,
I've been using the player movement code from AUM 46. However it doesn't really have any proper collision included. When colliding with level blocks it can move through them while slowly moving upwards. Would it be possible to explain what I need to change to get it to stop movement when hitting a wall?
Here is the code:
Thanks a lot!!!
I've been using the player movement code from AUM 46. However it doesn't really have any proper collision included. When colliding with level blocks it can move through them while slowly moving upwards. Would it be possible to explain what I need to change to get it to stop movement when hitting a wall?
Here is the code:
Code:
action player1 { player = my; my.x = -2700; my.y = -2500; my.z = -2000; my.pan = 160; my.transparent = on; my.alpha = 100; my.skill40 = camera_distance; my.skill41 = camera_height; camera_mode = 3; while (1) { player.pan -= 10 * mouse_force.x * time - 1.5 * (key_a - key_d); camera.x = player.x - camera_distance * cos(player.pan); camera.y = player.y - camera_distance * sin(player.pan); camera.z = player.z + camera_height + 0.8 * sin(my.skill46 * 3.6); camera.pan = player.pan; camera.tilt += 7 * mouse_force.y * time; camera_distance = min (max (camera_distance, 5), 500); if (key_w + key_s > 0) { ent_cycle("walk", my.skill46); my.skill46 += 10 * (1 + key_shift * 0.5) * time; my.skill46 %= 100; } else { ent_cycle("stand", my.skill48); my.skill48 += 2 * time; my.skill48 %= 100; } if (camera_mode == 3) { avoid_obstacles(); } vec_set (temp, my.x); temp.z -= 10000; trace_mode = ignore_me + ignore_passable + use_box; temp.z = -trace (my.x, temp); temp.x = 10 * (key_w - key_s) * (1 + 1 * key_shift) * time; temp.y = 0; my.skill47 += ent_move (temp, nullvector); if (my.skill47 > 50) { snd_play(step_wav, 30, 0); my.skill47 = 0; } wait (1); } }
Thanks a lot!!!