Changeset 89

Show
Ignore:
Timestamp:
12/04/07 19:12:14 (1 year ago)
Author:
spidermo
Message:

Partial tank

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/tank.d

    r85 r89  
    7373        loadResources(); 
    7474         
    75         physics = new Circle(image_body.getFrame.getSize.h/2, 1000);//new Box(image_body.getFrame.getSize, 10); 
     75        physics = new Box(image_body.getFrame.getSize, 1000);//new Box(image_body.getFrame.getSize, 10); 
    7676        physics.sigCollideStart.attach(&onCollideStart); 
    7777        physics.translation = translation; 
     
    9494        //physics.force = Point.fromPolar(0.005, physics.rotation - PI/2); 
    9595        //Cout("player: "~.toUtf8(radToPlayer)~" tank: "~.toUtf8(physics.rotation)); 
    96         if(physics.rotation +PI_2 + PI_4 - tilemap.playerLoc.angle(transform.translation) == 0) 
     96        /*if(physics.rotation +PI_2 + PI_4 - tilemap.playerLoc.angle(transform.translation) == 0) 
    9797        { 
    9898            physics.angularVelocity = 0.0; 
     
    105105        { 
    106106            physics.angularVelocity = -0.001; 
     107        }*/ 
     108        Cout("Tank: "~transform.translation.toUtf8()~" - "~tango.text.convert.Float.toUtf8(physics.rotation)); 
     109        if(transform.translation.x < (-tilemap.pixWidth/2 + 10)) 
     110        { 
     111            physics.force = Point(0,0); 
    107112        } 
    108         /*if(radToPlayer > -0.1 && radToPlayer < 0.1) 
    109             physics.angularVelocity = 0.0; 
    110         else if(radToPlayer > 0) 
    111             physics.angularVelocity = -0.005; 
     113        else if(transform.translation.x > (tilemap.pixWidth/2 + 10)) 
     114        { 
     115            physics.force = Point(0,0); 
     116        } 
     117        else if(transform.translation.y < (-tilemap.pixHeight/2 + 10)) 
     118        { 
     119            physics.force = Point(0,0); 
     120        } 
     121        else if(transform.translation.y > (tilemap.pixHeight/2 + 10)) 
     122        { 
     123            physics.force = Point(0,0); 
     124        } 
    112125        else 
    113             physics.angularVelocity = 0.005;*/ 
    114          
     126        { 
     127            if(tilemap.playerLoc.distance(transform.translation) > 1000.0) 
     128            { 
     129                physics.velocity = Point.fromPolar(0.005, physics.rotation - PI/2); 
     130                physics.angularVelocity = 0.0; 
     131            } 
     132            else 
     133            { 
     134                physics.velocity = Point(0.0,0); 
     135                physics.angularVelocity = 0.0; 
     136            } 
    115137        } 
     138    } 
    116139     
    117140    /*void drawScenegraph ()