Frame stitching

Talk about making games.

Frame stitching

Postby game_mate » Tue Feb 07, 2006 2:27 am

I am triing to make an overhead hovercraft game.My problem is the motor mounted on the rear is parented to the body.I would like to make the motors frame number = the bodys frame number so that they follow in 360 degrees reletive to one another. Frames for each are every 10 degrees. Does anyone know a script that would HELP.
thanks
Game_Mate
game_mate
 
Posts: 16
Joined: Sat Dec 11, 2004 2:37 am
Score: 0 Give a positive score

Postby unigamer » Tue Feb 07, 2006 8:06 am

Create a variable for the parent and set it to animpos:

current_frame = animpos;

And on the motor set:

animpos = current_frame;



This code may not work because I'm fairly new to Game Editor but I'm pretty sure the rough idea is right.
unigamer
 
Posts: 12
Joined: Sat Jan 28, 2006 6:59 pm
Score: 0 Give a positive score

Frame stitching 2

Postby game_mate » Tue Feb 07, 2006 4:42 pm

That worked for the frames, but is there a way to make the motor follow the ark of the hover craft wile maintaining the ability to change frames if i want that event to happen. If anyone knows a way to script that pleas help
game_mate
 
Posts: 16
Joined: Sat Dec 11, 2004 2:37 am
Score: 0 Give a positive score

Postby DilloDude » Tue Apr 04, 2006 2:20 am

Add the following in global code:
Code: Select all
float d2R(int degrees)
{
    return degrees * (3.1415926535897932384626433832795 / 180);
}

double xdist(int deg, double dist)
{
    return  dist * cos(d2R(deg));
}

double ydist(int deg, double dist)
{
    return -dist * sin(d2R(deg));
}

Now, in draw actor->motor:
Code: Select all
x=hover.x;
y=hover.y;
x+=xdist(angle between hovercraft and motor(hovercraft.angle-180), distance from hovercraft center);
y+=ydist(angle between hovercraft and motor(hovercraft.angle-180), distance from hovercraft center);

This is useful for anything where an actor should be a certain distance from another. My brother helped me make it for creating a shot at the end of a cannon's barrel, and I modified it to make two functions.

Another way that solves some problems is to make the animation rotate around a central point.
Image
User avatar
DilloDude
 
Posts: 866
Joined: Tue Jan 24, 2006 9:51 am
Location: Nyerellion
Score: 58 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest