Positioning display in front of rotating character

For questions about using Classic.

Post » Thu Jul 09, 2009 4:18 am

I'm toying with a control scheme much like the Ghost Shooter where you control where a player is looking with the mouse, however, I'd like for the camera to be focused... let's say 100 pixels in front of the character. However, which direction is in front of the player can change depending on where he's looking.

Is there a simple way to position the camera X distance from an object in the direction it is facing?

Any equation for it is completely escaping me at the moment.
B
5
G
3
Posts: 23
Reputation: 975

Post » Thu Jul 09, 2009 4:27 am

I would probably go with a dummy object with "center view on me" ticked in preferences.
Then always have the character facing the dummy.
Image Image
B
161
S
48
G
90
Posts: 7,356
Reputation: 66,767

Post » Thu Jul 09, 2009 4:31 am

That's what I figured I'd be doing, but I'm still not sure how to keep the dummy object exactly X distance away from the player sprite in the direction of the mouse...
B
5
G
3
Posts: 23
Reputation: 975

Post » Thu Jul 09, 2009 4:42 am

Oh, I got it, and without a dummy object!

I create a new image point 100 points to the right of the right end of the player object and have an event to scroll the camera to the X and Y of that point.

And it's excruciatingly dizzying. I may have to tweak that if I don't want to get people sick.
B
5
G
3
Posts: 23
Reputation: 975

Post » Thu Jul 09, 2009 10:04 pm

Scrolling effects which sound cool before you make them often seem to come out bad. I thought it'd be cool if your character always faced the same angle, and the world rotated as you moved the mouse. It was incredibly confusing :P I think scrolling works best when totally predictable.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Fri Jul 10, 2009 2:04 am

It's actually working really well now. I've got an image point slightly in front of the player character and the camera focuses on that, that means the player character is slightly off-center so the visual space can be focused more on his cone of vision.

However, I'm seeing if I can throttle the speed of the camera to speed up if it needs to rotate far, and slow down if it doesn't. Hopefully that'll make the off-center scroll just a little bit smoother. This may be a bit much to pull off but I want to give it a shot.

Here's my current events.



It properly throttles up to the max speed, but it never comes back down.
I think I'm missing something obvious, but I'm too blearly-minded to figure it out at the moment. Maybe someone else can come up with a better solution.
B
5
G
3
Posts: 23
Reputation: 975


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 6 guests