Beginner's Sprite Tutorial
Re: Beginner's Sprite Tutorial
I'm assuming you want an 8px char.
Does it need to be 16px width ?
I have 2 simple ones, with 16px character, in 24px width.
and
Interested ?
Does it need to be 16px width ?
I have 2 simple ones, with 16px character, in 24px width.
and
Interested ?
Re: Beginner's Sprite Tutorial
They look a bit too good for purposes here! They are 2 sexy looking sprites.
Could you post the frames here and perhaps I can modify the blob?
Could you post the frames here and perhaps I can modify the blob?
-
- Manic Miner
- Posts: 390
- Joined: Sun Nov 12, 2017 3:54 pm
Re: Beginner's Sprite Tutorial
Yeah is it possible to see the frames for the 2nd one?
The 1st looks sound but the right leg in the 2nd one looks a bit weird at times. It could just be trying to view a small image in my phone, though.
The 1st looks sound but the right leg in the 2nd one looks a bit weird at times. It could just be trying to view a small image in my phone, though.
Re: Beginner's Sprite Tutorial
I think it is because of the first (standing) frame and the frame after it.
In the standing frame the two legs do not fully overlap, and in the following frame the two feet are drawn differently, so that the forward foot is the left one. It creates the impression that only the left leg makes forwards steps. If both feet overlapped in the middle frame, so they looked like only one foot, and the stepping frames made the left and right feet look the same, the steps would look a little better (though it would then be inconsistent with the perspective on the face).
Nice sprites!
Re: Beginner's Sprite Tutorial
Here are Zoom versions of them.
And
I also have the SevenUp Editor .SEV files somewhere in my drive, I'll have a look and post them when found.
The issue you see is related with a bunch of pixels that are together on the left leg, when it's up in front.
It comes out as a brighter spot due to that, and that's what makes it feel a bit odd.
But if we remove those pixels, it seems the leg never crossed over, or the right leg might seem too bulky.
Maybe there are better solutions, but it's not easy at this size, in my opinion.
but feel free to change or update them, they can always be improved.
Thank you for all the positive comments, for my first walk animation studies, done quite a few months ago.
And
I also have the SevenUp Editor .SEV files somewhere in my drive, I'll have a look and post them when found.
I could try that, when I have a half an hour or so free.
There is something there yes, but I believe there isn't much that can be done about it, without looking funny, or having to change the whole sprite.redballoon wrote: ↑Fri Dec 29, 2017 10:41 am ...
The 1st looks sound but the right leg in the 2nd one looks a bit weird at times. It could just be trying to view a small image in my phone, though.
The issue you see is related with a bunch of pixels that are together on the left leg, when it's up in front.
It comes out as a brighter spot due to that, and that's what makes it feel a bit odd.
But if we remove those pixels, it seems the leg never crossed over, or the right leg might seem too bulky.
Maybe there are better solutions, but it's not easy at this size, in my opinion.
but feel free to change or update them, they can always be improved.
Thank you for all the positive comments, for my first walk animation studies, done quite a few months ago.
Re: Beginner's Sprite Tutorial
OK here are the SevenUp .SEV files.
WalkAnim-Study.sev
WalkAnim-Study3F.sev
You know the drill, after loading the files, just use cursor keys to animate the frames.
You can move the first anim sprites to be centered on a char boundary, since currently it's centered between 2 chars.
After taking a new look on the second anim, I'm sure it can be improved, by making the first stance after center position, to have a slighter larger gap between both legs.
You can also notice that both do not have arms yet.
Well, they were my first walk anims, what can I say, not perfect.
The one in my Avatar is a lot better, but also easier, with more pixels to shuffle
WalkAnim-Study.sev
WalkAnim-Study3F.sev
You know the drill, after loading the files, just use cursor keys to animate the frames.
You can move the first anim sprites to be centered on a char boundary, since currently it's centered between 2 chars.
After taking a new look on the second anim, I'm sure it can be improved, by making the first stance after center position, to have a slighter larger gap between both legs.
You can also notice that both do not have arms yet.
Well, they were my first walk anims, what can I say, not perfect.
The one in my Avatar is a lot better, but also easier, with more pixels to shuffle
- Ast A. Moore
- Rick Dangerous
- Posts: 2641
- Joined: Mon Nov 13, 2017 3:16 pm
Re: Beginner's Sprite Tutorial
Code: Select all
ld b,(hl) ;get table address spritegraphic0, spritegraphic1 etc in BC
ld l,c
ld h,b
Code: Select all
ld h,(hl)
ld l,c
Every man should plant a tree, build a house, and write a ZX Spectrum game.
Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
Re: Beginner's Sprite Tutorial
Nice thread this. Finally got round to having a decent look at this as I still haven't managed to write a decent pixel-based sprite routine.
In the Balachor games the sprite moved 4 pixels at a time, so I thought I may as well store X & Y co-ordinates as character co-ordinates 0-31, or 0-22. I did that mainly because I had previously been used to PRINT AT in BASIC.
I did a bit of experimentation with smoother movement, so it made sense for the Y-coordinate (vertical) to be a pixel co-ordinate of 0-192. But I still had the X-coordinate (horizontal) as 0-31, as I figured this was the only precision needed for horizontal screen addresses.
I didn't even consider storing the X co-ordinate as 0-255, and getting both the screen address and the sprite animation frame from that. I guess that's a more standard (and probably more sensible!) approach. I had the sprite animation frame as a separate variable.
In the Balachor games the sprite moved 4 pixels at a time, so I thought I may as well store X & Y co-ordinates as character co-ordinates 0-31, or 0-22. I did that mainly because I had previously been used to PRINT AT in BASIC.
I did a bit of experimentation with smoother movement, so it made sense for the Y-coordinate (vertical) to be a pixel co-ordinate of 0-192. But I still had the X-coordinate (horizontal) as 0-31, as I figured this was the only precision needed for horizontal screen addresses.
I didn't even consider storing the X co-ordinate as 0-255, and getting both the screen address and the sprite animation frame from that. I guess that's a more standard (and probably more sensible!) approach. I had the sprite animation frame as a separate variable.
My Speccy site: thirdharmoniser.com
- Ast A. Moore
- Rick Dangerous
- Posts: 2641
- Joined: Mon Nov 13, 2017 3:16 pm
Re: Beginner's Sprite Tutorial
Even that isn’t enough when you’re dealing with fractional coordinates and sprites moving smoothly beyond the edges of the screen. Some clever trickery is required for that.Morkin wrote: ↑Fri Dec 29, 2017 2:59 pm it made sense for the Y-coordinate (vertical) to be a pixel co-ordinate of 0-192. But I still had the X-coordinate (horizontal) as 0-31, as I figured this was the only precision needed for horizontal screen addresses.
I didn't even consider storing the X co-ordinate as 0-255, and getting both the screen address and the sprite animation frame from that. I guess that's a more standard (and probably more sensible!) approach.
Every man should plant a tree, build a house, and write a ZX Spectrum game.
Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
Re: Beginner's Sprite Tutorial
Ok, I tried a couple of revisions ...
First I tried to add 2 steps instead of one, in 8 frames, which is doable, but since in this case we only want to advance 8 pixels, steps need to be small, which implies feet need to be small.
But I did not like the outcome ... looks like "Miss Bob" in high heels
Hence I reverted back to a single step, which gave me a lot more control.
Now I like this, but there is a catch.
If you repeat this, you will see that the back leg seems to drag, this is normal, because it's the animation of a single step, to a stop, so back leg has to slow down ... to a stop.
For 2 steps, we need the last 4 frames, to move the back leg a lot faster, since it's swinging to take the lead.
This is required, to make it look natural, i.e. we need to swap the last few frames to stop, or to keep walking.
I don't have more time now, to make the full walk version, 4 more frames.
The body movement, will be identical or similar, but the back leg, needs to speed up, and end half bent, to continue.
I hope it helps.
UPDATE:
Here is a longer repeating version, where it looks like he is limping, as I mentioned before.
First I tried to add 2 steps instead of one, in 8 frames, which is doable, but since in this case we only want to advance 8 pixels, steps need to be small, which implies feet need to be small.
But I did not like the outcome ... looks like "Miss Bob" in high heels
Hence I reverted back to a single step, which gave me a lot more control.
Now I like this, but there is a catch.
If you repeat this, you will see that the back leg seems to drag, this is normal, because it's the animation of a single step, to a stop, so back leg has to slow down ... to a stop.
For 2 steps, we need the last 4 frames, to move the back leg a lot faster, since it's swinging to take the lead.
This is required, to make it look natural, i.e. we need to swap the last few frames to stop, or to keep walking.
I don't have more time now, to make the full walk version, 4 more frames.
The body movement, will be identical or similar, but the back leg, needs to speed up, and end half bent, to continue.
I hope it helps.
UPDATE:
Here is a longer repeating version, where it looks like he is limping, as I mentioned before.
Re: Beginner's Sprite Tutorial
I've now got as far as preshifting in my tutorial series, in a bit of a scattershod way.
Happy new year!
Happy new year!
Robin Verhagen-Guest
SevenFFF / Threetwosevensixseven / colonel32
NXtel • NXTP • ESP Update • ESP Reset • CSpect Plugins
SevenFFF / Threetwosevensixseven / colonel32
NXtel • NXTP • ESP Update • ESP Reset • CSpect Plugins
Re: Beginner's Sprite Tutorial
you seem to have gotten the multicolor sprite moving smoothly right to left as well as up and down
Re: Beginner's Sprite Tutorial
is this BASIC or Machine code. if it's the latter, would ZEUS be good?
Re: Beginner's Sprite Tutorial
Which bit? The sprite code I posted on page 3 is assembly language that the ZX-Spin 0.666 assembler translates into machine code. There are no nobs & whistles so I think any assembler including ZEUS should be fine with it
Re: Beginner's Sprite Tutorial
i get errors whenever i attempt to call a sprite.
Callsprite drawsprite and deletesprite all get errors
even with the call command
Callsprite drawsprite and deletesprite all get errors
even with the call command
Re: Beginner's Sprite Tutorial
[mention]MrPixel[/mention] have you got your simple example working in Zeus first? Zeus has what I call configuration options before the code. [mention]Seven.FFF[/mention] explains it very well in his tutorial. Get that working first.
Did you write that previous piece of code yourself and do you have coding experience in assembler from your Atari time?
Did you write that previous piece of code yourself and do you have coding experience in assembler from your Atari time?
Re: Beginner's Sprite Tutorial
no, from a different section of this site. and i used zx spin 0.666PeterJ wrote: ↑Tue Mar 27, 2018 6:50 pm @MrPixel have you got your simple example working in Zeus first? Zeus has what I call configuration options before the code. @Seven.FFF explains it very well in his tutorial. Get that working first.
Did you write that previous piece of code yourself and do you have coding experience in assembler from your Atari time?
really wish there was a hot key to assemble
Re: Beginner's Sprite Tutorial
OK. So I would get a small example working in Zeus, then move on to the bigger stuff like sprites. As others have said the Spectrum does not have Sprites, it's just code which tries to replicate what other machines did in hardware. Get a simple example working in your development environment of choice then move on. As mentioned the various documents, websites and books others have linked you to should get you started.
Re: Beginner's Sprite Tutorial
That version of Spin has been abandonware for at least 11 years, so it's really unlikely there's going to be any more changes to make it easier to user. Dunny is an ace developer, but he's moved onto other projects long ago.
It would probably help you to use something actively developed. To contrast with Spin, In the 15 months I've been using Zeus I have 110 old versions saved in my archive. I honestly don't think it's an exaggeration to say that about 70% of those have workflow improvements, new features, etc resulting from my own feedback to Simon, and I'm only one of many people using the tool. The Windows Z80 cross-platform version has been developed on an almost a daily basis for the last ten years, and the design draws directly from the native Spectrum Zeus in the early 80s, and even older 8080 versions back to 1977.
Which is not to say that you have to use Zeus, by any means! Everyone has their favourite tools that feel right and suit their workflow, and nobody's making them use anything else. But if you're picking a new tool without any history or preconceptions, it seems a shame to hobble yourself right from the get go.
It would probably help you to use something actively developed. To contrast with Spin, In the 15 months I've been using Zeus I have 110 old versions saved in my archive. I honestly don't think it's an exaggeration to say that about 70% of those have workflow improvements, new features, etc resulting from my own feedback to Simon, and I'm only one of many people using the tool. The Windows Z80 cross-platform version has been developed on an almost a daily basis for the last ten years, and the design draws directly from the native Spectrum Zeus in the early 80s, and even older 8080 versions back to 1977.
Which is not to say that you have to use Zeus, by any means! Everyone has their favourite tools that feel right and suit their workflow, and nobody's making them use anything else. But if you're picking a new tool without any history or preconceptions, it seems a shame to hobble yourself right from the get go.
Robin Verhagen-Guest
SevenFFF / Threetwosevensixseven / colonel32
NXtel • NXTP • ESP Update • ESP Reset • CSpect Plugins
SevenFFF / Threetwosevensixseven / colonel32
NXtel • NXTP • ESP Update • ESP Reset • CSpect Plugins
Re: Beginner's Sprite Tutorial
deletesprite, movesprite and drawsprite are from [mention]R-Tape[/mention]'s tutorial in the first post of this topic, not my blog, so I can't offer any specific advice. What [mention]PeterJ[/mention] says is sound sense - build the foundations then work up from there.
Robin Verhagen-Guest
SevenFFF / Threetwosevensixseven / colonel32
NXtel • NXTP • ESP Update • ESP Reset • CSpect Plugins
SevenFFF / Threetwosevensixseven / colonel32
NXtel • NXTP • ESP Update • ESP Reset • CSpect Plugins
Re: Beginner's Sprite Tutorial
[mention]Seven.FFF[/mention] apart from in your tutorial are there any documents that explains the configuration bits you put before the code?
I suppose I have always used Pasmo because you don't need all that extra stuff, but I should spend some time on Zeus especially as it has an.emulator built in..
I suppose I have always used Pasmo because you don't need all that extra stuff, but I should spend some time on Zeus especially as it has an.emulator built in..
Re: Beginner's Sprite Tutorial
Yes, for sure. The documentation is distributed on a non-linear fashion between here and here.
For a quick start, if you go File >> New ZX Spectrum (48K) you get a commented template. But let's see. This is what I consider to be the minimum configuration for a new project:
Code: Select all
zeusemulate "48K"
A lot of the Zeus options can be specified in the UI or in code. Doing it in the UI is obviously simpler and more intuitive, but doing it in the code has the advantage of being able to open, assemble and run multiple projects without having to tweak settings.
Code: Select all
zoLogicOperatorsHighPri = false
This is also corresponds to one of the many checkboxes on the Config tab.
Code: Select all
zoSupportStringEscapes = false
Code: Select all
Zeus_PC = $nnnn
Stack equ $nnnn
Conceptially, it's more like what happens at the point you finish loading a .z80 or .sna shapshot. The entire state of the machine is restored, before jumping to the entry point.
There are also other directives to set the registers, interrupt mode and enabled state, current 128K page, etc.
Instead of Zeus_PC you can also use the pasmo syntax of END $nnnn at the end of your code. For pasmo, that is an instruction to put a RANDOMIZE USR nnnnn command in the basic loader; for Zeus, it's an instruction for the emulator where to put the entry point.
It might seem like a pointless distinction, but having code injected directly makes 128K development a breeze - literally all eight 16K pages (or in the case of the Spectrum Next, all 223 8K pages!!) are in memory and ready to use right from the getgo, without the user having to write code to export them and merge them with a multipage loader.
Code: Select all
org $nnnn
Code: Select all
org zeuspage(7)
Code: Select all
output_z80"..\bin\blah.z80", $0000, EntryPoint
output_sna"..\bin\blah.sna", $0000, EntryPoint
output_tap"..\bin\blah.tap", "LoaderProgramName", "Comment", StartAddress, BytesToSave, 2, EntryPoint
output_tzx "..\bin\blah.tzx", "LoaderProgramName", "Comment", StartAddress, BytesToSave, 2, EntryPoint
Where this gets interesting is the 128K/sparse memory scatterloader (mode 3) tape files, for example:
Code: Select all
output_tap"..\bin\blah.tap", "LoaderProgramName", "Comment", StartAddressOfBlock, BytesOfBlockToSave, 3, EntryPoint, BorderColours
output_tap_block "..\bin\blah.tap",StartAddressOfSecondBlock, BytesOfSecondBlockToSave
output_tap_block "..\bin\blah.tap",StartAddressOfThirdBlock, BytesOfThirdBlockToSave
If there's a loading screen at $4000-$5AFF (loaded with something like this):
Code: Select all
import_bin "loading.scr", $4000
Robin Verhagen-Guest
SevenFFF / Threetwosevensixseven / colonel32
NXtel • NXTP • ESP Update • ESP Reset • CSpect Plugins
SevenFFF / Threetwosevensixseven / colonel32
NXtel • NXTP • ESP Update • ESP Reset • CSpect Plugins
Re: Beginner's Sprite Tutorial
I believe we all need some good article about this Zeus
It's seems that it became a serious player among crossassemblers quite recently.
It was always Sjasm or Pasmo before. Okay, maybe not always but last 10 years which seems like always
I'm personally not up to date. When I hear Zeus I think about this thing from 1983
https://spectrumcomputing.co.uk/index.p ... 96&id=9010
It's seems that it became a serious player among crossassemblers quite recently.
It was always Sjasm or Pasmo before. Okay, maybe not always but last 10 years which seems like always
I'm personally not up to date. When I hear Zeus I think about this thing from 1983
https://spectrumcomputing.co.uk/index.p ... 96&id=9010
Re: Beginner's Sprite Tutorial
Just to give a little teaser about another one of my fav Zeus features, I have a USB cable running into to my Spectrum Next, which has an integrated 2Mbps serial port. At the click of a button, Zeus assembles code, loads it down the wire into memory, and executes at the entry point.
It has a command line interface, so by typing my own commands I can list memory, do pokes, write to ports, reset the machine, disassemble any address (including 128K pages that aren't even currently paged in) with the source lines next to them, import files from disk on the PC into memory, and export memory blocks to disk on the PC.
Pretty much what any emulator debugger does - except that none of the emulators for the Next are fully functional yet, and the bits that are functional don't behave the same as they do on the real hardware.
You could get this running on a real Spectrum with a serial or parallel interface too, pretty easily (with some input from Simon).
It has a command line interface, so by typing my own commands I can list memory, do pokes, write to ports, reset the machine, disassemble any address (including 128K pages that aren't even currently paged in) with the source lines next to them, import files from disk on the PC into memory, and export memory blocks to disk on the PC.
Pretty much what any emulator debugger does - except that none of the emulators for the Next are fully functional yet, and the bits that are functional don't behave the same as they do on the real hardware.
You could get this running on a real Spectrum with a serial or parallel interface too, pretty easily (with some input from Simon).
Robin Verhagen-Guest
SevenFFF / Threetwosevensixseven / colonel32
NXtel • NXTP • ESP Update • ESP Reset • CSpect Plugins
SevenFFF / Threetwosevensixseven / colonel32
NXtel • NXTP • ESP Update • ESP Reset • CSpect Plugins
Re: Beginner's Sprite Tutorial
[mention]R-Tape[/mention]. Is there any chance you could do versions of your examples to cover up and down from here please:
viewtopic.php?f=6&t=2575
viewtopic.php?f=6&t=2575