view question

Talk about making games.

Re: view question

Postby Bee-Ant » Sat Jul 03, 2010 8:14 pm

I thought you've already ask this so many times...

Put this code on View -> Draw Actor -> Script Editor :
Code: Select all
x=max(Player.x-width/2-2,min(x,Player.x-width/2+2));
y=max(Player.y-width/2-2,min(y,Player.y-width/2+2));


*Note: Change "Player" to your player's name.
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: view question

Postby Bee-Ant » Sat Jul 03, 2010 8:36 pm

sp1d3r wrote:is there any ways to keep the player always in the middle of the view no matter if u fall ,jump,jump down and across,jump up and across

sp1d3r wrote:i dont want it to be alway center on the y

It's quite confusing...I dunno which one you really need... :roll:
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: view question

Postby savvy » Sun Jul 04, 2010 7:05 am

why dont u try and use the parent function, change the views parent to the actor you wish
--> For my help, i ask for a simple +1 if it helps! ^-^
--> I dont code, I type art which you dont understand.
--> I keep winning the 3D model challenge at college, teacher says: "you keep winning im not giving you prizes".
User avatar
savvy
 
Posts: 494
Joined: Wed Jun 03, 2009 11:55 am
Location: England
Score: 44 Give a positive score

Re: view question

Postby savvy » Sun Jul 04, 2010 7:09 am

or try this, its a bit long winded but it works. put all of these on your view in a draw actor function.
Code: Select all
if(player.x>x)
{
x+=5;
}

if(player.x<x)
{
x-=5;
}

if(player.y>y)
{
y-=5;
}

if(player.y<y)
{
y+=5;
}
--> For my help, i ask for a simple +1 if it helps! ^-^
--> I dont code, I type art which you dont understand.
--> I keep winning the 3D model challenge at college, teacher says: "you keep winning im not giving you prizes".
User avatar
savvy
 
Posts: 494
Joined: Wed Jun 03, 2009 11:55 am
Location: England
Score: 44 Give a positive score

Re: view question

Postby Bee-Ant » Sun Jul 04, 2010 9:09 am

savvy wrote:
Code: Select all
if(player.x>x)
{
x+=5;
}

if(player.x<x)
{
x-=5;
}

if(player.y>y)
{
y-=5;
}

if(player.y<y)
{
y+=5;
}


Bee-Ant wrote:
Code: Select all
x=max(Player.x-width/2-2,min(x,Player.x-width/2+2));
y=max(Player.y-width/2-2,min(y,Player.y-width/2+2));

This code do the samething...with much more shorter...
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest