Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Information about object: obj_player
- Sprite: spr_player_right
- Solid: false
- Visible: true
- Depth: 0
- Persistent: false
- Parent:
- Mask:
- Create Event:
- execute code:
- turning = false;
- dir = 1;
- spd = 5;
- Step Event:
- execute code:
- /* Gravity */
- if (place_free(x,y+1))
- {
- gravity_direction = 270;
- gravity = 1;
- }
- else gravity = 0;
- /* Controls */
- if (keyboard_check_pressed(vk_left))
- {
- if (dir = 1)
- {
- sprite_index = spr_player_turnl;
- image_speed = .5;
- turning = true;
- }
- dir = -1;
- }
- if (keyboard_check_pressed(vk_right))
- {
- if (dir = -1)
- {
- sprite_index = spr_player_turnr;
- image_speed = .5;
- turning = true;
- }
- dir = 1;
- }
- if (keyboard_check(vk_left) || keyboard_check(vk_right))
- {
- for (i = 0; i <= 8; i += 1)
- {
- if (place_free(x+(spd*dir),y-i))
- {
- x += spd*dir;
- y -= i;
- break;
- }
- }
- image_speed = .5;
- }
- else if (!turning)
- {
- image_speed = 0;
- image_index = 0;
- }
- if (keyboard_check(ord("Z")) && gravity = 0)
- {
- vspeed = -12;
- }
- Collision Event with object obj_block:
- execute code:
- if (direction = 270 && other.y >= y)
- {
- move_contact_solid(270,8);
- vspeed = 0;
- }
- Collision Event with object obj_block_ghost:
- execute code:
- if (vspeed >= 0)
- {
- with (obj_block_ghost)
- {
- solid = true;
- }
- if (other.y >= y && !place_free(x,y+vspeed))
- {
- //move_contact_solid(270,8);
- vspeed = 0;
- }
- if (other.y < y && !place_free(x,y+vspeed))
- {
- move_contact_solid(90,8);
- vspeed = 0;
- }
- }
- else
- {
- if (vspeed < 0)
- {
- with(obj_block_ghost)
- {
- solid = false;
- }
- }
- }
- Other Event: Outside Room:
- execute code:
- room_restart();
- Other Event: Animation End:
- execute code:
- if (dir = -1) sprite_index = spr_player_left;
- else if (dir = 1) sprite_index = spr_player_right;
- turning = false;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement