#AnimateObjects - Animated Textures for most Objects.

1 messages · Page 1 of 1 (latest)

humble elm
#

This will allow you to make any object animated (as long as it is detected by G.P_CENTERS), allowing you to basically animate any Consumables, Jokers, Blinds, you name it.

What does this currently allow you?

You can make Objects' sprite change in a loop, or you can even make it change randomly. You can also make it run an animation only once, which should open up some new opportunities for you to work with. This is just a fun side-project of mine, so feel free to take and change it however you want.

#

oh oops, realized i forgot to add tags

#

💀

humble elm
#

hmmmmmmmm i kinda wanted to make this work only ONE card of a joker too, but currently i have no way to find the pos of that so yeah

main elbow
#

@craggy swift , @primal trench

primal trench
craggy swift
#

Oh fun

primal trench
#

Oh

#

This is interesting

humble elm
#

you can make it so it only changes ONE card now

#

instead of all cards of that joker

humble elm
#

after testing with multiple jokers, i can confidently say that it works fine (for jokers)

#

idk about other objects though :D

livid snow
#

examples?

humble elm
#

so basically, you can use this function:

AddRunningAnimation({"j_joker",0.1,5,2,"loop",0,0,card"})
  • "j_joker": This part specifies the object's key, which will change the sprite of ALL objects with that key if a specific card is not declared.
  • 0.1: Basically how many second should it pass before a new frame is loaded in.
  • 5: Runs from startX (in this case, 0, which is the first 0) to 5, then goes back to 0 and increases Y by 1
  • 2: Runs from startY (in this case, 0, which is the second 0) to 2, then goes back to 0, completing an Animation Loop.
  • "loop": Specifying that the Animation is a "loop", which will repeat until it is manually removed.
  • card: I specified the card here, which will only change the sprite of one card. Though, for cases where a Joker should always have its Sprite running on an animation, you don't need to declare this.
#

im pretty sure i explained everything in the code, and you should probably modify it somewhat since its a bit unorganized lol

#

the "x" and "y" part works like the sprite_pos in a Joker if you dont understand how it works

#

yeah actually i might reorganize the code, add in a few more features in case someone need them like changing a card's soul

bitter egret
#

Hi, forgive me for being dumb but I need a quick ELI5 for this one (i think im not quite lua-savy enough), how does this work exactly?
Specifically: what do I do with animateObject.lua? and how do i use AddRunningAnimation? i get its used to add cards into dt_table but what do i do for that exactly? do i put the card i want to animate somewhere in animateObject.lua or do i specificy it when defining the joker in my own mod file?

bitter egret
#

Update: I think I've figured out how it works and I'm gonna leave a quick ELI5 for anyone else trying to do the same by explaining how I did it

  1. Place animateObject.lua (download in this post) in your mod folder.

  2. Use SMODS.load_file('animateObject.lua)()' in your main mod lua file to load the extra file. make sure you do this above where you define the jokers you want to animate so it gets loaded properly.

  3. use the function AddRunningAnimation() in your joker definition (SMODS.joker{}) to animate it. You will still have to define atlas and pos like normal. Make sure atlas is an atlas that contains every frame of your animation, left to right, top to bottom.
    3.5) the correct setup for AddRunningAnimation() is AddRunningAnimation({'j_(your mod prefix here)_(your joker key here), (time between frames), (number of frames across your atlas is minus one), (ditto but for height instead of across), (type of animation (usually loop)), 0, 0, card})
    3.5.5) Note: the length and height code works by the same logic as pos = {} does, which is why the lengths have to be subtracted by one.

  4. Overall if done correctly it should be structured like this:

--- PREFIX: example_prefix

...

SMODS.load_file('animateObject.lua')()

...

SMODS.Atlas{ --atlas for your animated texture, should contain all frames of your animation
    key = 'animatedjokeratlas',
    path = 'animatedjokeratlas.png',
    px = 71,
    py = 95
}

...

SMODS.Joker{
    key = 'myanimatedjoker',
    ...
    atlas = 'animatedjokeratlas',
    pos = {x = 0, y = 0) --the first frame of the animation. the animation will run to the right until reaching the defined length, then go back to the left and down one, repeat until hitting the end of the defined height.
    AddRunningAnimation({'j_example_prefix_myanimatedjoker',0.125,5,5,'loop',0,0,card}),

This doesn't include everything but it should be enough for anyone to make it work, hopefully.

pastel rune
#

does this script still work? I've been messing with it for a bit and can't get it working (not trying to do it with jokers though)

I'm testing an animated deck of cards because I feel like it'd be kinda cool to make, but I'm awful at lua :p

arctic apex
#

damn, if only there was a bounce loop

cedar mauve
#

Is there a way applying the script to the an overlay? like in legendary cards

humble elm
#

dropping this because, yeah

arctic apex
#

I can’t see the code on mobile so that’s why I ask

cedar mauve
#

yo is it possible to use this effect on seals?

desert rover
#

I'm having some trouble getting this to function