Page 1 of 1
how can u make the view follow ur mouse?
Posted:
Thu Dec 13, 2007 10:32 pm
by Kooldudese
Well... pretty much my question is my subject... how can u make the view follow ur mouse...
Re: how can u make the view follow ur mouse?
Posted:
Thu Dec 13, 2007 10:34 pm
by jman
yeah good question
Re: how can u make the view follow ur mouse?
Posted:
Thu Dec 13, 2007 10:40 pm
by Bee-Ant
Put this code on DrawActor of your view actor :
- Code: Select all
view.x=mouse.x;
view.y=mouse.y;
Re: how can u make the view follow ur mouse?
Posted:
Fri Dec 14, 2007 12:32 am
by Game A Gogo
or how can you move the view with the mouse?
- Code: Select all
view.x+=xmouse-(view.width/2);
view.y+=ymouse-(view.height/2);
I think this code should work =3
Re: how can u make the view follow ur mouse?
Posted:
Sun Dec 16, 2007 6:32 pm
by Kooldudese
Oh... thx... game a gogo... but i have another question related to this, how can you make a barrier so that the view can only follow the mouse in a certain place oh and can you control the speed that the view moves?
Re: how can u make the view follow ur mouse?
Posted:
Sun Dec 16, 2007 7:10 pm
by Kalladdolf
enter script for draw actor
if (view.x > //your right limit position)
{view.x = //your right limit position ;}
if (view.x < //your left limit position)
{view.x = //your left limit position ;}
if (view.y > //your bottom limit position)
{view.y = //your bottom limit position ;}
if (view.y < //your top limit position)
{view.y = //your top limit position ;}
ok, that'll do for your barrier.
but I'm not sure about controlling the speed.
because you can move your mouse in all speeds you want.
maybe a more advanced code would do, but I can't help you here.
Re: how can u make the view follow ur mouse?
Posted:
Mon Dec 17, 2007 1:14 am
by Game A Gogo
you would need to create an actor that would be used as a ghost and make it follow the mouse
- Code: Select all
double speed=3.5;//This is your speed
if(view.x>M_Ghost.x)view.x-=speed;
else if(view.x<M_Ghost.x)view.x+=speed;
if(view.y>M_Ghost.y)view.y-=speed;
else if(view.y<M_Ghost.y)view.y+=speed;
I'm not sure if this will work, but it should make you able to control the speed
Re: how can u make the view follow ur mouse?
Posted:
Fri Jan 04, 2008 11:09 pm
by Kooldudese
Im not sure how the ghost would be like... i tried it and it dident really come out propperly, the view does follow the mouse but the speed isent controlled, the barrier works though thx ==Kalladdolf== could you try to make a demo game a gogo?
Re: how can u make the view follow ur mouse?
Posted:
Sat Jan 05, 2008 1:01 am
by Game A Gogo
I will :3