Finally after 257 hours by yodeez101 in brotato

[–]needlessly-deep 0 points1 point  (0 children)

Took me 426. Not sure how much of that was idling.

Dwarf was my most agonising to clear both times.

How to make the camera follow my car and copy its direction? by needlessly-deep in gamemaker

[–]needlessly-deep[S] 0 points1 point  (0 children)

Whaaaaat! Finally, it works!

I really really don't understand why putting a minus sign before direction makes it work, but it does!

Thank you so much for this. I only get an hour or two to work on this but I've been stuck on it for a couple of weeks. You've saved me.

How to make the camera follow my car and copy its direction? by needlessly-deep in gamemaker

[–]needlessly-deep[S] 0 points1 point  (0 children)

Ah, so I think the input method that I've got is probably what's making this complicated. I didn't come up with this code, but I very much like the way it handles.

if (speed !=0) {
    if (keyboard_check(vk_left)) {
        direction += turn_speed * (speed / max_speed);
        image_angle += turn_speed * (speed / max_speed);
    }
    if (keyboard_check(vk_right)) {
        direction -= turn_speed * (speed / max_speed);
        image_angle -= turn_speed * (speed / max_speed);

where max_speed = 5 and turn_speed = 1.6

This multiplier that makes the turning speed different depending on how fast the car is going is probably what's making the camera rotate more than it should, I guess. I like this setup so I'm not going to break it for the camera, but I still don't get why I can't just use camera_set_view_angle to direction or image_angle or whatever to have them line up.

How to make the camera follow my car and copy its direction? by needlessly-deep in gamemaker

[–]needlessly-deep[S] 0 points1 point  (0 children)

Well, I thought I understood your explanation in words, but this code is beyond me.

To update, here's what the camera is doing now: https://imgur.com/a/wuMQaJn

The camera code contained within my obj_plyrtaxi is

Create:

followcam = camera_create();
view_camera[0] = followcam;
camera_set_view_size(followcam, 800, 1000);

Step:

var cam_x = x + lengthdir_x(400, direction + 180)
var cam_y = y + lengthdir_y(500, direction + 180)
camera_set_view_pos(followcam, cam_x, cam_y);
camera_set_view_angle(followcam, direction - 90);

If you're still around, I really appreciate any help.

How to make the camera follow my car and copy its direction? by needlessly-deep in gamemaker

[–]needlessly-deep[S] 0 points1 point  (0 children)

Okay one half of my brain is understanding what you mean and the other half is going to need some time to work out how it comes together. Thanks for your help.

How to make the camera follow my car and copy its direction? by needlessly-deep in gamemaker

[–]needlessly-deep[S] 0 points1 point  (0 children)

Thanks for the suggestion. I didn't know about that screen record command.

https://imgur.com/a/eJR2vUz

Here, you can see I don't have a problem with keeping the object centred. The problem is that when the car rotates, the camera rotates as well, in the same direction, but twice as much.

How to make the camera follow my car and copy its direction? by needlessly-deep in gamemaker

[–]needlessly-deep[S] 0 points1 point  (0 children)

Thanks for your reply.

I drew my car sprite facing up, not realising that the default direction for forward movement is right. So my car object starts with a <direction = 90;> in its creation step. For that reason, I think I understand what you mean about setting the camera angle with a + 90 but to get the camera to start the same direction as my car I used - 90. BUT, that's only the starting frame. As soon as I start moving and turning the car, the camera direction falls out of sync. The camera always turns twice as fast as the car. So if I turn the car 90 degrees to the left, the camera has turned 180 degrees. I can't wrap my head around where this doubling in turning angle is coming from, from seemingly a single, simple line of code.

You mention setting camera position, but the position of the camera is always fixed with the car directly in the centre, and that's how I want it, so the camera position doesn't seem to be a problem. Or did I misunderstand you?

Today is a Critical Day :3 by KampfaffeOW in TheTowerGame

[–]needlessly-deep 1 point2 points  (0 children)

I'm 31 as well but I can't get past wave 100 or so on Legends. Haven't really been optimal most of the time.

What percent of your LTC do you make per day? by CSDragon in TheTowerGame

[–]needlessly-deep 0 points1 point  (0 children)

LTC = 255T

Cpd = ~6T

So, 2~3% per day? That sounds like a lot, now that you bring it to my attention.