Title: Re: Better way to moving 'sprites'
Post by: bplus on August 07, 2021, 11:41:14 am
Quote
I wonder if there is a way to improve it.
Yes! many ways, Cobalt, Unseen many others have developed whole systems to tiling, building backgrounds and sprites....
It probably starts by making tile images and then building images for more images so can move sprite as one image.
Title: Re: Better way to moving 'sprites'
Post by: bplus on August 07, 2021, 11:57:03 am
Can you make a routine to draw your sprite at any x,y? Usually x,y is top, left corner of image but could be it's middle too. With that, use arrow keys or mouse to say the x, y position of sprite.
Title: Re: Better way to moving 'sprites'
Post by: RobinGravel on August 07, 2021, 12:19:01 pm
Doesn't sprites always draw from left?
Is there other alternatives to draw sprites?
Title: Re: Better way to moving 'sprites'
Post by: loudar on August 07, 2021, 12:34:26 pm
There are many ways in which you could "improve" this, though that's always subjective of course.
For me, I like having my sprites as images within a folder, then load them and be able to just play with them how I want. That removes code from the program and generalizes the drawing part a lot. I wrote some functions in QB64 that can do that in my latest Gamejam participation: https://github.com/loudar/Gamejam-2021-07-24 (https://github.com/loudar/Gamejam-2021-07-24)
There are many options how you can tweak this, it totally depends on your coding style and your end goal ;D
Title: Re: Better way to moving 'sprites'
Post by: bplus on August 07, 2021, 02:36:51 pm
Here is simple code for a bat sprite to follow mouse position:
As you can see here, I've simply made two 16x16 sorites and then used READ to read the data and create my bat images, which I then simply use PUTIMAGE to display to the screen. It doesn't get any easier than that.
Title: Re: Better way to moving 'sprites'
Post by: bplus on August 07, 2021, 07:24:17 pm
Yeah that would be next step, bit of a learning curve though (with _NewImage with _Dest and _PutImage)
Sorite?, not Soarite? ;-))
Title: Re: Better way to moving 'sprites'
Post by: SMcNeill on August 07, 2021, 09:50:08 pm