pdk
Smash Lord
- Joined
- Jul 20, 2006
- Messages
- 1,320
maybe you could consider and experiment with a system like this:
1) stats for a move (e.g. damage, IASA) could either be hard-coded or stored in a separate file depending on which way you're more comfortable with
2) instead of using another way (e.g. a 2d array as in my above example) to determine whether a move animation is available, simply test for the existence of either that move's folder or the first frame in its animation and return the "no move here" message if these aren't found
3) you could avoid even more hard-coding data by having a function that runs after the "is there an animation to show for this?" condition returns true; this function would simply take count of the frames in a move by looking for a starting frame, the frame after that, etc. for example, in a 20-frame move, it could simply look for 1.jpg, look for 2.jpg if it finds 1, etc., simply assuming that the animation is over when it can't find 21.jpg (though you probably already have another way to do this, you get the point). afterward it could return the count of frames it finds as an integer to another function (which you seem to already have in place, judging from the use of jpgs for frames), which would then construct the animation in the same way it does already (obviously with some slight changes take the previous function as an argument instead of a hard-coded value).
1) stats for a move (e.g. damage, IASA) could either be hard-coded or stored in a separate file depending on which way you're more comfortable with
2) instead of using another way (e.g. a 2d array as in my above example) to determine whether a move animation is available, simply test for the existence of either that move's folder or the first frame in its animation and return the "no move here" message if these aren't found
3) you could avoid even more hard-coding data by having a function that runs after the "is there an animation to show for this?" condition returns true; this function would simply take count of the frames in a move by looking for a starting frame, the frame after that, etc. for example, in a 20-frame move, it could simply look for 1.jpg, look for 2.jpg if it finds 1, etc., simply assuming that the animation is over when it can't find 21.jpg (though you probably already have another way to do this, you get the point). afterward it could return the count of frames it finds as an integer to another function (which you seem to already have in place, judging from the use of jpgs for frames), which would then construct the animation in the same way it does already (obviously with some slight changes take the previous function as an argument instead of a hard-coded value).