From 908b5cbdbc11650686ab9931a93a6c6e6668ff8e Mon Sep 17 00:00:00 2001 From: entar Date: Tue, 10 Jun 2025 12:08:30 +0700 Subject: [PATCH] Update Types --- Types.md | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 62 insertions(+), 1 deletion(-) diff --git a/Types.md b/Types.md index 1ed1b28..f410545 100644 --- a/Types.md +++ b/Types.md @@ -15,4 +15,65 @@ But the type itself has functions to manupulate those x and y. - `Vector2:Div(number) -> Vector2` -- Divide a Vector2 by a certain number - `Vector2:Negate() -> Vector2` -- Returns the negative version of this Vector2. -x, -y - `Vector2:Get() -> number, number` -- Returns x and y. local x, y = Vector2:Get() -- `Vector2:Lerp(Vector2, number) -> Vector2` -- Returns a Lineally Interpolated Vector2 between those 2 Vector2's. Position = 0-1 \ No newline at end of file +- `Vector2:Lerp(Vector2, number) -> Vector2` -- Returns a Lineally Interpolated Vector2 between those 2 Vector2's. Position = 0-1 + +## Creation +myTypes.Vector2(number?, number?) + +# Image + +Another base type. This makes image operating easier than using default love.graphics.newImage, applies camera offsets and other resizes. + +## Children +- `Image.image` - love.image -- Actual loaded image. +- `Image.resize` - Vector2(1,1) -- Resize on X and Y. +- `Image.position` - Vector2 -- Position. +- `Image.modifier` - number -- Scroll factor relative to camera position. 0-inf. +- `Image.rotation` - number -- Image rotation. +- `Image.layer` - number -- Layer that Image renders on. + +## Functions +- `Image:Destroy()` - Removes the image from the list, won't render anymore. + +## Creation +myTypes.Image(string, number?) -- Image path, Scroll factor + +# Sprite + +Not so base type here now. Loads and caches the spritesheet, parses the atlas, converts it to quads and caches it. +Every update updates the sprite based on it's current animation and framerate. + +## Children +- `Sprite.image` - love.image -- Actual loaded image. +- `Sprite.position` - Vector2 -- Sprite position. +- `Sprite.extraOffset` - Vector2 -- Extra offset for character per-animation. +- `Sprite.modifier` - number -- Scroll factor relative to camera position. 0-inf. +- `Sprite.layer` - number -- Layer that Sprite renders on. +- `Sprite.rotation` - number -- Sprite rotation. + +## Functions +- `Sprite:Destroy()` -- Removes the sprite from the list, won't render anymore. Cache still remains. +- `Sprite:PlayAnimation(string, number, bool?)` -- Plays a animation from the atlas on the specified FPS, loops if specified. +- `Sprite:StopAnimation()` -- Stops the current animation. + +## Creation +myTypes.Sprite(string, string) -- Image path, Atlas path + +# Rect + +Sprite, but doesn't play a animation and saves up space and game FPS. + +## Children +- `Rect.image` - love.image -- Actual loaded image. +- `Rect.position` - Vector2 -- Rect position. +- `Rect.extraOffset` - Vector2 -- Extra offset for character per-animation. +- `Rect.modifier` - number -- Scroll factor relative to camera position. 0-inf. +- `Rect.layer` - number -- Layer that Rect renders on. +- `Rect.rotation` - number -- Rect rotation. + +# Functions +- `Rect:Destroy()` -- Removs the rect from the list, won't render anymore. Cache still remains. +- `Rect:Frame(string, number)` -- Sets the current animation and a frame for the Rect. + +## Creation +myTypes.Rect(string, string) -- Image path, Atlas path \ No newline at end of file