Jump to content

LEFans

Members
  • Posts

    100
  • Joined

  • Last visited

Posts posted by LEFans

  1. Liitle piece of your code will make us understand you much better wink.png

    Show how you UpdateController() function works in your code.

    Code error. UpdateController ( ) iterations parameters is too large. Thank you.

    Really like your game: The Last Chapter. Almost done?

  2. Chinese New Year is the most important festivity for the Chinese people. It is also called the Spring Festival or the Lunar New Year.

     

    Every year has an animal’s name. These animals are the rat, ox, tiger, rabbit, dragon, snake, horse, ram, monkey, rooster, dog and pig. A Chinese legend says that these twelve animals had a race. The first year was named after the rat, the winner. The other eleven years were named after the order in which the animals arrived in the race. The clever rat jumped onto the ox’s back then at the end jumped over the ox’s head to arrive first!

     

    The Chinese believe that a person born in a particular year has some of the characteristics of animal.

     

    On Chinese New Year’s Eve all family members enjoy a big, delicious meal. It is very important for the Chinese to be with their families on this occasion. Fish is always part of the dinner because it represents abundance.

     

    On New Year’s Day all Chinese children wear new clothes with bright colors. Red is considered a lucky color. Parents and relatives give children the traditional New Year’s gift called lucky money. This money is put into bright red and gold envelopes. Fill under the pillow. in the morning of new year , the kid wakes up to see the “lucky money”, express that oneself become one year older. Red is a traditional color for festivals, celebrations, weddings and birthdays.

     

    The lion dancers are always part of the festivities. The lion has a big head and long body made of cloth. The lion dance is accompanied by drums, cymbals and noisy firecrackers. According to ancient traditions the great noise frightens away evil spirits.

     

    The dragon is the most important figure of the Chinese New Year festivities and parades. The dragon is considered a lucky figure. A parade dragon can be 20 to 30 meters long! Sixty or more men move under a long cloth that represents the dragon’s tail.

     

    During the parade children represent the animals of the Chinese calendar. There are also acrobats and musicians in beautiful costumes.

     

    Happy New Year!

  3. If an entity is another entity child objects

    Please use:

    TFormPoint(point,src,dst)

    Conversion position

     

    http://www.leadwerks.com/werkspace/files/file/273-lupins-le2-3d-game-engine-starter-kit-for-delphi-and-freepascal/

    delphi2C++:

    #include "engine.h"
    
    float AngleDiff(float angle1, float angle2)
    {
    angle1 =fmodf(angle1,360);
    if (angle1<0)
    	angle1=angle1+360;
    
    angle2 =fmodf(angle2,360);
    if (angle2<0)
    	angle2=angle2+360;
    
    if (angle1 > angle2)
    {
    	if(angle1 - angle2 < 360 + angle2 - angle1)
    		return (angle1 - angle2) * -1;
    	else
    		return 360 + angle2 - angle1;
    }
    if (angle2 > angle1)
    {
    	if (angle2 - angle1 < 360 + angle1 - angle2)
    		return angle2 - angle1;
    	else
    		return (360 + angle1 - angle2) * -1;
    }
    return 0;
    }
    int main(int argc, char** argv)
    {
    TPick *pick =new TPick;
    float move = 0;
    float strafe = 0;
    float jump = 0;
    TVec3 playerpos;
    TVec3 meshpos;
    TVec3 campos;
    int gx = 0;
    int gy = 0;
    int mz = 0;
    float dx = 0;
    float dy = 0;
    float camerapitch = 0;
    float camerayaw = 0;
    float dist = 0;
    
    float framebegin = 0;
    float frameend = 0;
    float frame = 0;
    
    float rd;
    float rc;
    
    Initialize();
    RegisterAbstractPath("F:\\3D\\leadwerks v2.4");
    	Graphics(800,600);
    
    CreateFramework();
    
    TEntity scene = LoadScene("abstract::train.sbx");
    TMesh crawler = LoadMesh("abstract::crawler.gmf");
    
    TEntity camera =GetLayerCamera(GetFrameworkLayer(0));
    PositionEntity(camera,EntityPosition(crawler));
    
    AmbientLight(Vec3(1.0f, 1.0f, 1.0f));
    
    TController player = CreateController();
    EntityType(player,3);
    EntityType(player,1);
    SetBodyDamping(player,0.0);
    SetWorldGravity(Vec3(0,-20,0));
    SetBodyMass(player,1);
    
    Collisions(2,3,1);
    
    gx = GraphicsWidth() / 2;
    gy = GraphicsHeight() / 2;
    
    move = 0.0f;
    strafe = 0.0f;
    camerapitch = 0.0f;
    camerayaw = 0.0f;
    dist = 2.0f;
    
    HideMouse();
    MoveMouse(gx, gy);
    
    mz = MouseZ();
    // Main loop
    while (!KeyHit(KEY_ESCAPE))
    {
        DebugPhysics(KeyDown(KEY_Q));
    
        if (MouseZ() != mz)
        {
            if (mz < MouseZ())
            {
    			dist = dist - ((MouseZ() - mz) / 5.0f);
    			if (dist < 1)
    				 dist = 1;
            }
            else
            {
    			dist = dist + ((mz - MouseZ()) / 5.0f);
    			if (dist > 5)
    				dist = 5;
            }
            mz = MouseZ();
        }
        dx = Curve((MouseX() - gx) / 5.0f, dx, 5.0f / AppSpeed());
        dy = Curve((MouseY() - gy) / 5.0f, dy, 5.0f / AppSpeed());
        MoveMouse(gx, gy);
        camerapitch = camerapitch + dy;
        camerayaw = camerayaw - dx;
        Min(camerapitch, 90.0f);
    	Max(camerapitch,  -90.0f);
        RotateEntity(camera,Vec3(camerapitch, camerayaw, 0.0f), true);
    
        move = (KeyDown(KEY_S) || MouseDown(MOUSE_MIDDLE)) - (KeyDown(KEY_W) || MouseDown(MOUSE_LEFT));
        strafe = KeyDown(KEY_A) - KeyDown(KEY_D);
    
        if ((move != 0) || (strafe != 0))
        {
    		rd = fmodf( EntityRotation(crawler).Y, 360);
            rc = fmodf(EntityRotation(camera).Y + 180, 360);
    		if (abs(fmodf(rd - rc,360)) <= 12.0f)
    			RotateEntity(crawler,Vec3(0.0f, rc, 0.0f));
            else
            {
    			if (AngleDiff(rc, rd) < 0)
    				TurnEntity( crawler,Vec3(0.0f, 6.0f * AppSpeed(), 0.0f));
    			else
    				TurnEntity(crawler,Vec3(0.0f,  -6.0f * AppSpeed(), 0.0f));
    
    			if (move != 0.0f)
    				move = move / 5.0f;
    			if (strafe != 0)
    				strafe = strafe / 5.0f;
            }
        }
        jump = 0.0f;
        if ((move != 0))
        {
            framebegin=131,frameend=171;
        }
        else if ((strafe != 0))
        {
            framebegin=70,frameend=130;
        }
        else
        {
            framebegin=0,frameend=68;
        }
        frame =AppTime()/29.0f;
           frame =fmodf(frame,frameend-framebegin)+framebegin;
           Animate(crawler,frame,1.0,0,true);
        UpdateController(player,EntityRotation (crawler).Y, move * 3.0f, strafe * 2.0f, jump, 40.0f);
    
        playerpos = EntityPosition(player);
        meshpos = EntityPosition(crawler);
        meshpos.Y = Curve(playerpos.Y, meshpos.Y, 2.0f);
        meshpos = Vec3(playerpos.X, meshpos.Y, playerpos.Z);
        PositionEntity(crawler,meshpos);
    
        campos = TFormPoint(Vec3(0, 1, 0), crawler,0);
    	PositionEntity (camera,campos);
    	MoveEntity(camera,Vec3(0, 0,  -dist));
    
    	//HideEntity(player);
    	HideEntity(crawler);
    	if (LinePick(pick,campos, EntityPosition(camera), 0.5f))
            PositionEntity(camera,Vec3(pick->X,pick->Y,pick->Z));
        MoveEntity(camera,Vec3(0.0f, 0.0f, 0.2f));
    	// ShowEntity(player);
        ShowEntity(crawler);
    	UpdateFramework();
    	RenderFramework();
        Flip();
    }
    return Terminate();
    }

  4.  /*if (!CreateWorld()) {
           MessageBoxA(0,"Error","Failed to create world.",0);
           goto exitapp;
           }*/
    
    CreateFramework();//Include up to the world
    //TEntity cam= CreateCamera(pivot);
    //Can so
    TEntity cam =GetLayerCamera(GetFrameworkLayer(0));
    EntityParent(cam,pivot);

×
×
  • Create New...