I was looking for a way for instance where in my code i currently have; BEN(sprite) set animation to IDLE,
to instead have VARIABLE set animation to IDLE. this means whatever selection populated and set the variable at the start will always be able to be retrieved.
I know how to set global variables, but are you able to please show me how to reference pulling it in my action code?
there are 2 ways ... and i prefer the global variable as is more compact... and streamlined...
the other one just duplicates events, and from 50 events for character animation/movement your might end up with a cluster of 1000 or more... depending on how many characters you have in selection menu.
sure there is the array way, the json way etc... but to keep it simple... 1 global variable + 1 sprite with multiple animations is my solution...or choice...
now personally i know it might be counter intuitive if you have 10 character sprites... and they look different, id just have 1 sprite with 100 animations or how many animations 1 character needs
and just rename the animations based on character value selection, like lets say ben is nr 1 ... considering everything in construct starts from zero 1 would actually be sort of object nr 2 doesn't make any sense in this mention since i would rename the animations like
jump_1
idle_1
die_1
walk_1
etc...
and just change the numbers... now when you select the animation to play just set on your keyboards eevents
on left (trigger once) pressed character set animation to "walk_"&characterSelection (global variable)
etc ...
this way you eliminate having 100 sprites for each character selection... you sort of streamline the character being 1 object, and reduce the number of events/behaviors/actions to 1 sprite instead of 100 which is going to be events N*100 characters in duplication code... they will work... either way... just long run project is going to be insane to go back and make a change to each character you have in selection screen, especially once your projects comes close to release product.
Edited: on the other hand... you can diminish the character animations by using spriter or spline animations... use the global variable... and assemble your characters from parts and reuse the same animation on all of them, as at this point animations are skeletal based and not frame dependent.
but if you have 1 character design and you just change the color of them... like red mario purple mario green mario... i would just HUE effect and keep 1 sprite.