like aoe

Game Editor comments and discussion.

like aoe

Postby kes » Fri Mar 23, 2007 9:57 pm

hi, its me again, now im trying to do the view move like in the Real Time Strategy games, but just in the x axis
kes
 
Posts: 7
Joined: Sun Feb 18, 2007 9:24 pm
Score: 1 Give a positive score

Postby Sgt. Sparky » Fri Mar 23, 2007 10:22 pm

draw actor for view:
Code: Select all
angle = direction(x + width / 2, y + height / 2, Player.x, y + height / 2);
directional_velocity = distance(x + width / 2, y + height / 2, Player.x, y + height / 2) / 25;

that should work :D
notice that I do not use Player.y,
that is because you do not want the view to move up and down :D
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

Postby kes » Sat Mar 24, 2007 2:55 am

thanks man!! you saved my game again!!
kes
 
Posts: 7
Joined: Sun Feb 18, 2007 9:24 pm
Score: 1 Give a positive score

Postby DilloDude » Sat Mar 24, 2007 1:04 pm

rather than using y + height / 2, you could set then both to 0, since they are both the same. That way, it will not have to calculate y + height /2 every time. Also, if you are just using the x axis, the whole thing could be simplified to
Code: Select all
xvelocity = (Player.x - (x + width * .5)) / 25;
I changed width / 2 to width * .5, since it should be more efficient. if you know the width of your screen, you can just put that to be faster still. If you are using 800x600, you would put in 400 instead of width * .5. 1024x 768 would be 512. If you wanted to use it in multiple places you could make it a define. Put
Code: Select all
#define halfwidth 512
in Global Code (or whatever the value is). Then, instead of the width * .5, you can just put halfwidth. This is easier to remember, plus if you are using it in multiple places, and you want to change the resolution, you only have to change one place.
Image
User avatar
DilloDude
 
Posts: 866
Joined: Tue Jan 24, 2006 9:51 am
Location: Nyerellion
Score: 58 Give a positive score

Postby Sgt. Sparky » Sat Mar 24, 2007 6:48 pm

I just used the + height /2 + width /2 ect. stuff to make it so you would not have to just start out with the calculations,
you could also do in global
Code: Select all
#define halfX view.width / 2
#define halfY view.height / 2

:D
so you could replace the x + view.width or height / 2
with x + halfX
or y + half Y
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

Postby UltimatHedgehog » Sun Mar 25, 2007 1:09 am

Sgt. Sparky wrote:draw actor for view:
Code: Select all
angle = direction(x + width / 2, y + height / 2, Player.x, y + height / 2);
directional_velocity = distance(x + width / 2, y + height / 2, Player.x, y + height / 2) / 25;

that should work :D
notice that I do not use Player.y,
that is because you do not want the view to move up and down :D

how do i make the veiw switch to do this after i collide with something
Image
I always thought Hell would be a giant load screen that goes on for eternity, then one day, eons later, it would end, only to reveal a slightly different loading screen.
User avatar
UltimatHedgehog
 
Posts: 325
Joined: Fri Jan 19, 2007 1:48 pm
Location: http://downloads.khinsider.com/?u=112542 plz click
Score: 10 Give a positive score

Postby Sgt. Sparky » Sun Mar 25, 2007 6:06 pm

make a global var called Able.
then on the draw actor for the view actor
use this
Code: Select all
if(Able == 1)
{
   angle = direction(x + width / 2, y + height / 2, Player.x, y + height / 2);
   directional_velocity = distance(x + width / 2, y + height / 2, Player.x, y + height / 2) / 25;
}

on collision on whatever side you want of the collideactor,
Code: Select all
Able = 1;

:D
EDIT:
you can also use if Able is 2 to make the view move to a different actor :D
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score

Postby UltimatHedgehog » Sun Mar 25, 2007 11:57 pm

i want it to follow it in y too so i added Player infront of y too but it made veiw go down so my feet were sticking down from off screen when i jumped to the higher platform
see i already have veiw going like that. I want it to change there so i can get to the higher spot and have veiw go up so im centered then go back to just x when i touch the second part of the higher platform

see what happened
Image
Image
I always thought Hell would be a giant load screen that goes on for eternity, then one day, eons later, it would end, only to reveal a slightly different loading screen.
User avatar
UltimatHedgehog
 
Posts: 325
Joined: Fri Jan 19, 2007 1:48 pm
Location: http://downloads.khinsider.com/?u=112542 plz click
Score: 10 Give a positive score

Postby Sgt. Sparky » Mon Mar 26, 2007 12:52 am

then use player.y instead of y + height / 2 :D
Image
Random Links:
viewtopic.php?p=19474#19474
Right now (10/14/2009) I'm working on some C++ projects, but I might be able to help if you have some Game Editor questions. :)
User avatar
Sgt. Sparky
 
Posts: 1850
Joined: Sat Oct 07, 2006 5:28 pm
Location: Somewhere out there, beneath the pale blue sky...
Score: 236 Give a positive score


Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest

cron