pascalabcnet/InstallerSamples/Graphics/ABCObjects/Sprites/gr_SpriteCreation.pas

29 lines
1 KiB
ObjectPascal
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// Создание спрайта и его состояний
uses GraphABC,ABCSprites,ABCObjects,Events;
var s: SpriteABC;
begin
Window.Title := 'Создание спрайта';
SetWindowSize(400,300);
CenterWindow;
// Создание спрайта и добавление в него кадров
s := new SpriteABC(150,100,'SpriteFrames\multi1.bmp');
s.Add('SpriteFrames\multi2.bmp');
s.Add('SpriteFrames\multi3.bmp');
s.Add('SpriteFrames\multi2.bmp');
s.Add('SpriteFrames\multi4.bmp');
s.Add('SpriteFrames\multi5.bmp');
// Добавление состояний к спрайту
s.AddState('fly',4); // Летать - 4 кадра
s.AddState('stand',1); // Стоять - 1 кадр
s.AddState('sit',1); // Сидеть - 1 кадр
// Задание скорости спрайт-анимации (1..10)
s.Speed := 9;
// Сохранение спрайта в "длинный" рисунок и создание информационного файла спрайта
s.SaveWithInfo('spr.png');
end.