I want to attach a series of rendered sprites to my joystick controller. I’ve rendered out an image for each 15 degrees of rotation. My joystick is calculating directional vectors that can be converted to angles, so I think if I put the images into a table, and set them based on the current angle of the joystick, I can set the appropriate image.
This sounds like something that somebody might have already done. Does anybody know of some existing code I can check out for help, or can you provide any advice before I get started? Math is not my strongest suit, and I think there’s probably some neat math trick that would help make this easier than what I might come up with by myself.
I’ll share back my joystick code along with directional movement when I’ve got it worked out.
Thanks in advance!
Also, if I want to load these images from a server - is there a way to make a loading bar to display progress? Example code would be helpful!
I would simply calculate math.floor(angle/15+1) which gives you a number 1 to 8 and use this to look up one of your images in a table
You can’t show progress of downloading an individual image. It happens in the background. You can however update the progess bar as each image completes and you start downloading the next one.
A loading bar is simply a rectangle on the screen, the simplest would be a solid one showing progress, on top of a fainter one that shows how far there is to go. But if you’re only showing the status each time an image is downloaded, you might just as well just put text on the screen saying “1 of 8 downloaded”
Is this for not-quite-overhead forced perspective 2D?
That’s helpful Ignatz - thanks! Yes, it’s the not quite overhead forced perspective, like you’d see in one of my current favorite games, Space Marshals.
You could also do an iOS-style loading indicator, instead of progress bar.
Something like this: