text stringlengths 0 234 |
|---|
procedure Move (Pt : GESTE.Pix_Point) is |
begin |
P.Set_Position (GESTE.Maths_Types.Point'(Value (Pt.X), Value (Pt.Y))); |
P.Sprite.Move ((Integer (P.Position.X) - 4, |
Integer (P.Position.Y) - 4)); |
end Move; |
-------------- |
-- Position -- |
-------------- |
function Position return GESTE.Pix_Point |
is ((Integer (P.Position.X), Integer (P.Position.Y))); |
-------------- |
-- Is_Alive -- |
-------------- |
function Is_Alive return Boolean |
is (P.Alive); |
------------ |
-- Update -- |
------------ |
procedure Update is |
Old : constant Point := P.Position; |
Elapsed : constant Value := Value (1.0 / 60.0); |
Collision_To_Fix : Boolean; |
begin |
-- Check collision with monsters |
if Check_Monster_Collision then |
P.Sprite.Flip_Vertical (True); |
P.Alive := False; |
end if; |
if Going_Right then |
Facing_Left := False; |
P.Sprite.Flip_Horizontal (True); |
elsif Going_Left then |
Facing_Left := True; |
P.Sprite.Flip_Horizontal (False); |
end if; |
-- Lateral movements |
if Grounded then |
if Going_Right then |
P.Apply_Force ((14_000.0, 0.0)); |
elsif Going_Left then |
P.Apply_Force ((-14_000.0, 0.0)); |
else |
-- Friction on the floor |
P.Apply_Force ( |
(Value (Value (-2000.0) * P.Speed.X), |
0.0)); |
end if; |
else |
if Going_Right then |
P.Apply_Force ((7_000.0, 0.0)); |
elsif Going_Left then |
P.Apply_Force ((-7_000.0, 0.0)); |
end if; |
end if; |
-- Gavity |
if not Grounded then |
P.Apply_Gravity (Value (-500.0)); |
end if; |
-- Wall grab |
if not Grounded |
and then |
P.Speed.Y > 0.0 -- Going down |
and then |
-- Pushing against a wall |
((Collides (Right_Wall)) |
or else |
(Collides (Left_Wall))) |
then |
-- Friction against the wall |
P.Apply_Force ((0.0, -4_0000.0)); |
Grabing_Wall := True; |
else |
Grabing_Wall := False; |
end if; |
-- Jump |
if Do_Jump then |
declare |
Jmp_X : Value := 0.0; |
begin |
if Grabing_Wall then |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.