We will create a sprite sheet animation system using JavaScript GitHub repo github.com/fah... Patreon / gamecodebites
Пікірлер: 16
@zakhariihusar69753 жыл бұрын
The best tutorial on spritesheet i've seen!
@augustusmark7153 жыл бұрын
instaBlaster...
@zakhariihusar69753 жыл бұрын
?
@gopalmandloi63744 жыл бұрын
As always Awesome Fahad.
@gamecodebites46723 жыл бұрын
Thank you!
@someuser33832 жыл бұрын
Do a full course of javascript game, please.
@Retrofire-472 жыл бұрын
my only grievance with this technique is that you are kinda polluting the global scope with all these variables... for a small animation loop that defines a program it makes sense, but if you have an actual video game then introducing like 10 entirely proprietary variables right at the top of the script becomes unsustainable almost immediately.. you would need a better way to store them
@eboatwright_3 жыл бұрын
Thanks! :D
@kiraireal3 жыл бұрын
I am the 1k view
@goncalolucas11033 жыл бұрын
i like you
@James-bu1ds3 жыл бұрын
Any samples of Vertical Sprite Images?
@gamecodebites46723 жыл бұрын
Sorry, this one only handles one row (row = 0) with multiple columns, but it's not hard to traverse through multiple vertical columns, you just need to add a variable to handle those slices, based on frame index and the position of slice in terms of the desired row.
@James-bu1ds3 жыл бұрын
@@gamecodebites4672 Can you help me how? Been stuck of this problem yesterday... just sample of vertical images
@gamecodebites46723 жыл бұрын
@@James-bu1ds should be something like this instead of what we have in the original animate function (didn't test it) function animate(state) { context.drawImage( spriteSheet, 0, state.frameIndex * frameHeight, frameWidth, frameHeight, xPos, yPos, frameWidth * scale, frameHeight * scale ); Notice that I changed the second param to be 0 and the third param to be state.frameIndex * frameHeight, and with this approach it will navigate vertically rather than horizontally, also you have to make sure to have the proper Sprite Sheet to have multiple rows rather than one single row. But again, I didn't test it, but it should give you an insight on how to achieve your goal. Good luck!
@James-bu1ds3 жыл бұрын
@@gamecodebites4672 That's hella help! Thank you very much