Page 1 of 1

Lookie Here...Ya Follow Me?

PostPosted: Tue Oct 31, 2006 2:17 am
by Pete Holland Jr.
Hey, everybody!

Yeah, I'm getting better! This is going swell. So far, I've incorporated a couple of static objects along with my player character. Now though, I'm looking for a little more help. I get the feeling it's possible, and I sort of see what I'm supposed to do, but I can't quite do it. The tutorial, I'm figuring, shows what I want to do, but the mouse is clicking on stuff that isn't there, and when I enter game mode after the tutorial is over, nothing happens.

I see how to make the camera follow the player, and how to add the view shifting depending on the average of locations. Here's what I'm hoping to pull off. I want the view to follow individual rooms. Take, for example, a little house. I designing it as three screen wide, and each screen is a room. Think along the lines of Pitfall or Maniac Mansion and you'll get the idea. I want the character to move freely within the "room" and the camera to remain static until I go off screen, at which time, the camera will snap to the middle of the next room I've entered.

So, it seems I need to make an actor and have it parent the view (set the transpanency, of course). One thought that occured to me was to create a global variable and, as the character moves, when the x variable for the character hits a certain point, like just above the value for the edge of the screen, change the x variable for the view to the new spot. Or, I suppose I can do something with wire frame activation regions, as well.

I sort of see how to do it, but I don't quite know how to implement it. Is what I'm looking to do possible, and if so, any suggestions on how I can go about it?

Sincerely,
Pete Holland Jr.

PostPosted: Tue Oct 31, 2006 5:08 am
by DilloDude
This is a simple method: add a draw actor event on the view (or you could add something similar on another actor, but this way you don't have as much other script to sort through:
Code: Select all
if (Player.xscreen < 0)
{
    x -= width;
}
else if (Player.xscreen > width)
{
    x += width;
}
else if (Player.yscreen < 0)
{
    y -= height;
}
else if (Player.yscreen > height)
{
    y += height;
}

You could also use the MoveTo function to move at a slower rate to the desired location.

Re: Lookie Here...Ya Follow Me?

PostPosted: Tue Oct 31, 2006 5:17 am
by Fuzzy
Pete Holland Jr. wrote:Hey, everybody!

So, it seems I need to make an actor and have it parent the view (set the transpanency, of course). One thought that occured to me was to create a global variable and, as the character moves, when the x variable for the character hits a certain point, like just above the value for the edge of the screen, change the x variable for the view to the new spot. Or, I suppose I can do something with wire frame activation regions, as well.

I sort of see how to do it, but I don't quite know how to implement it. Is what I'm looking to do possible, and if so, any suggestions on how I can go about it?

Sincerely,
Pete Holland Jr.


Yup. You are on the right path. I'd use four wireframe actors along each side of the view, with the view as their parent. if the player/actor hits them, then move the view forward. I would have each wireframe actor contain a value that represents how much to move the view. so...

view.x = view.x + amount;

Doing it this way, each wireframe can use the same basic code. For the wireframe to the west, you have amount = your view size. For the east one, have amount = -viewsize, or whatever value you need(the size of the room I guess).

You would need to adjust the player actor as well.

Good luck!

A Very Hearty Thank You

PostPosted: Wed Nov 01, 2006 1:44 am
by Pete Holland Jr.
I just wanted to say thanks to everyone. I truly appreciate the help. I hope I get good enough to return the favor some day. I'm learning a lot from you, and I appreciate it.

Sincerely,
Pete Holland Jr.

Mortal Enemy of GOTO