This repository has been archived on 2024-12-25. You can view files and clone it, but cannot push or open issues or pull requests.
2023-06-20 21:52:24 +03:00

27 lines
773 B
ObjectPascal

// Переключение состояний спрайта щелчком мыши
uses GraphABC,ABCSprites,ABCObjects,Events;
var
s: SpriteABC;
t: TextABC;
procedure MyMouseDown(x,y,mb: integer);
begin
if s.PtInside(x,y) then
begin
// Переход к следующему состоянию спрайта
if s.State<s.StateCount then
s.State := s.State + 1
else s.State := 1;
t.Text := 'Состояние спрайта: ' + s.StateName;
end;
end;
begin
Window.Title := 'Щелкните мышью на спрайте';
SetWindowSize(400,300);
CenterWindow;
s := new SpriteABC(150,100,'spr.spinf');
t := new TextABC(55,30,15,'Состояние спрайта: '+s.StateName,clRed);
OnMouseDown := MyMouseDown;
end.