• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

Windows After I break something my camera stops working and I cant break other stuff

1tsmey0sh1

Member
So I followed this tutorial:
and it seems that i cant break anything after breaking something and my camera stops following the player idk what i did wrong i checked the tutorial again and it seemed like i did everything correctly
 

flyinian

Member
Providing the code that you currently have may help with getting assistance. Also providing time stamps that you suspect your problem may lay in the video.
 

1tsmey0sh1

Member
Providing the code that you currently have may help with getting assistance. Also providing time stamps that you suspect your problem may lay in the video.
Hey so I followed the tutorial again (i deleted all of the code and re write it) and I still have the same problem
 

1tsmey0sh1

Member
No-one is going to watch a full video to help you. Post your code for breaking things and your camera code.
ok so the camera code is (on create)
// Resolution
enum RES {
WIDTH = 640,
HEIGHT = 390,
SCALE = 2
}

// Create camera
var _camera = camera_create_view(0, 0, RES.WIDTH, RES.HEIGHT, 0, Obj_player, -1, -1, RES.WIDTH/2, RES.HEIGHT/2);

// Set up view
view_enabled = true;
view_visible[0] = true;

view_set_camera(0, _camera);

(on clean up)
camera_destroy(view_camera);

(on end step)
var _playerexists = instance_exists(Obj_player);
var _helditem = noone;

if (_playerexists) _helditem = Obj_player.heldItem;

//depth
with (all) {
depth = -bbox_bottom;

// held item
if (_playerexists && _helditem == id) {
depth -= 30;
}
}

now for breaking things

(on create)
// vars
cooldown = 0;

//properties
rotation = 45;

breakDistance = 32;

//selector
selectorFrame = 0;
selectorFrameNumber = sprite_get_number(spr_selector);
selectorInst = noone;

(on step)
// Rotation
rotation = lerp(rotation, 45, 0.1);

image_angle = rotation * Obj_player.image_xscale;

//get input
var _mousePress = mouse_check_button(mb_left);

// get breakable instance at mouse position
var _breakable = instance_position(mouse_x, mouse_y, Obj_breakableparent);

with (_breakable) {
// get distance
var _dist = distance_to_object(Obj_player);

// in range?
if (_dist < other.breakDistance) {
// set selected
other.selectorInst = id;

//click
if (other.cooldown == 0 && _mousePress) {
// reduce hp
hp--;

// set rotation
other.rotation = -80;

// set cooldown
other.cooldown = 20;
}
}
}

//cooldown
if (cooldown > 0) cooldown--;

(on draw end)
//draw selector
if (instance_exists(selectorInst)) {
// run code in selected instance
with (selectorInst) {
// draw selector in all fout corners
draw_sprite_ext(spr_selector, other.selectorFrame, bbox_left, bbox_top, 1, 1, 0, -1, 1);

draw_sprite_ext(spr_selector, other.selectorFrame, bbox_right, bbox_top, 1, 1, -90, -1, 1);

draw_sprite_ext(spr_selector, other.selectorFrame, bbox_right, bbox_bottom, 1, 1, 180, -1, 1);

draw_sprite_ext(spr_selector, other.selectorFrame, bbox_left, bbox_bottom, 1, 1, 90, -1, 1);
}

//animation
selectorFrame += 0.15;

if (selectorFrame >= selectorFrameNumber) selectorFrame -= selectorFrameNumber;

//reset selector instance
selectorInst = noone;
}

this is the whole code for the camera and for breaking things
 
Top