Hello,

The following APIs have been added to branch dev_1.3:

   procedure Motion
     (Sprite              : in out Sprite_Type;
      Radial_Velocity     : in     Velocity_Type;
      Azimuth_Of_Velocity : in     Integer);
   procedure Radial_Velocity
     (Sprite : in out Sprite_Type;
      Value  : in     Velocity_Type);
   procedure Azimuth_Of_Velocity
     (Sprite : in out Sprite_Type;
      Value  : in     Integer);
   --  Specifies the motion of a sprite in polar coordinate
   procedure Orient_Velocity
     (Sprite            : in out Sprite_Type;
      To_Row, To_Column : in     Integer);
   --  Points the velocity vector to the specified point

and same for acceleration.

So it's easier to program a parabolic trajectory:
      App.SP1.Motion (50.0, -145);
      App.SP1.Acceleration (10.0, 90);
See full source code in pixi_sprite_test.adb.

And an automatic motion is available:

   procedure Move_To
     (Sprite              : in out Sprite_Type;
      Row, Column         : in     Integer;
      Radial_Velocity     : in     Velocity_Type;
      Radial_Acceleration : in     Acceleration_Type;
      Spent_Time          :    out Duration);
   --  Sets sprite motion in order to reach specified point on a straight line 
then stop.
   --  Based on specified target point, velocity and acceleration, actual 
velocity and acceleration are set
   --  during a calculated spent time. Whatever position, velocity or 
acceleration are changed during this time,
   --  velocity and acceleration are set to zero at the end of time. Thus the 
sprite may not have reached
   --  the target point. If the time cannot be calculated then Constraint_Error 
is raised.

No more annoying trials to tune the time to wait for a sprite to move from a 
position to another, Move_To do it automatically, see example in 
pixi_sprite_test.adb.

Feel free to send comments.

Enjoy, Pascal.
http://blady.pagesperso-orange.fr



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Gnoga-list mailing list
Gnoga-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gnoga-list

Reply via email to