Ha! So very true and many thanks for this! I love working these out, it's like when you finally figure out a tricky regex ~ seeing it come to life when you run it is a very nice feeling!
skoolkit generating sprites in html
Re: skoolkit generating sprites in html
Re: skoolkit generating sprites in html
OK, here's another one... This time, animations..! But still related to #UDGARRAY so I've kept it here.
I'm trying to generate a 2-step animation image.
I think I've managed to generate & display the two sprite images/frames - I've got this:
...They display fine. Next, I've managed to successfully create an animated image from these, with:
Yay, it works... But how can I put the animation graphic before the static images? So, for example, instead of
N 41212 ...
...use something like...
N 41176 ...?
If I try to do this, I get "Error while parsing #UDGARRAY macro: No such frame: "sprite-frame-1"
I guess it's because the frames aren't created until 41184..? Is there an easy way round this?
Alternatively, how do I display just the animation image, without displaying the (static) images?
I'm trying to generate a 2-step animation image.
I think I've managed to generate & display the two sprite images/frames - I've got this:
Code: Select all
N 41184 #HTML[#UDGARRAY1,4,4,1;41184-41199-8{0,0,32,64}(sprite-frame-1*)]
.
.
N 41204 #HTML[#UDGARRAY1,4,4,1;41204-41219-8{0,0,32,64}(sprite-frame-2*)]
Code: Select all
N 41212 #HTML[#UDGARRAY*sprite-frame-1,50;sprite-frame-2(animated-frames)]
N 41212 ...
...use something like...
N 41176 ...?
If I try to do this, I get "Error while parsing #UDGARRAY macro: No such frame: "sprite-frame-1"
I guess it's because the frames aren't created until 41184..? Is there an easy way round this?
Alternatively, how do I display just the animation image, without displaying the (static) images?
My Speccy site: thirdharmoniser.com
Re: skoolkit generating sprites in html
Yes, you can't use a frame until it's been defined (macros are expanded in the order in which they appear in the skool file).
To hide (i.e. create no file for) the static images and show only the animated image, you need a slight change of syntax when creating the sprite frames:
Also, can I ask why you're using the #HTML macro around the #UDGARRAY macros? There's nothing wrong with doing that, but I'm just wondering whether it's necessary.
To hide (i.e. create no file for) the static images and show only the animated image, you need a slight change of syntax when creating the sprite frames:
Code: Select all
#UDGARRAY1,4,4,1;41184-41199-8{0,0,32,64}(*sprite-frame-1)
#UDGARRAY1,4,4,1;41204-41219-8{0,0,32,64}(*sprite-frame-2)
#UDGARRAY*sprite-frame-1,50;sprite-frame-2(animated-frames)
Re: skoolkit generating sprites in html
Ah yes - that works a treat. Thanks. I thought I'd tried the alternate asterisk placement, but I suspect my syntax was wrong somewhere.
You're right, the #HTML shouldn't be there, perhaps I was using it for something else earlier and have been mindlessly copying and pasting it... Am finding it fairly commonplace to suddenly realise I've been doing things badly and there's a better command/macro, and then need to go back and change things.
You're right, the #HTML shouldn't be there, perhaps I was using it for something else earlier and have been mindlessly copying and pasting it... Am finding it fairly commonplace to suddenly realise I've been doing things badly and there's a better command/macro, and then need to go back and change things.
My Speccy site: thirdharmoniser.com
Re: skoolkit generating sprites in html
Indeed.
One thing I'm learning from is that disassembly is a marathon, not a sprint..!
Anyway, I've got another one...
I've got a bunch of 2-column sprites where left/right graphics are stored separately. Each graphic has a byte immediately before the graphic data indicating how many pixel rows it contains. Something like this:
Code: Select all
41926 DEFB 7, 120,71,64,64,64,71,120
41962 DEFB 3, 224,28,224
So in this example the left-side graphic consists of 7 pixel rows, and the right-side graphic 3 pixel rows.
Any suggestions for how to present this sprite neatly using the #UDGARRAY, or other macros?
I was wondering if I could 'pad' the second graphic with zeros somehow (the opposite of a CROP)?
My Speccy site: thirdharmoniser.com
Re: skoolkit generating sprites in html
This definitely can't be done by #UDGARRAY alone, because the graphic data's not arranged in groups of 8 bytes.
One possible approach is to create a buffer, copy the desired graphic data there such that it is arranged in groups of 8 bytes, and then point #UDGARRAY at the buffer. For example:
Code: Select all
@replace=/#copy\i,\i/#FOR(0,#PEEK\1-1)(n,#POKES(\2+n,#PEEK(\1+n+1)))
; Sprite
;
; #POKES23296,0,16
; #copy41926,23296
; #copy41962,23306
; #UDGARRAY2,scale=4;23296;23304(sprite)
b41926 DEFB 7,120,71,64,64,64,71,120
41934 DEFS 28
41962 DEFB 3,224,28,224
A bit cumbersome, but you could encapsulate it all in a single custom macro that does it in one shot, if needed.
Re: skoolkit generating sprites in html
Ah cool, thanks - nice to know there are ways...
Will have a proper look at that @replace directive at some point, probably after some caffeine so I can get my head round the syntax/parameters. Though I get the idea of what it's doing.
...Come to think of it I haven't used #FOR, #PEEK or #POKES yet so I'd better have a look at those first...
Will have a proper look at that @replace directive at some point, probably after some caffeine so I can get my head round the syntax/parameters. Though I get the idea of what it's doing.
...Come to think of it I haven't used #FOR, #PEEK or #POKES yet so I'd better have a look at those first...
My Speccy site: thirdharmoniser.com
Re: skoolkit generating sprites in html
I need your consultation.
I'm trying to create .png of a sprite made of indexes. $DDF9 is the start adress of bytes with index #00
and used this construction for doing that:
It works fine, finds the appropriate bytes at the calculated addresses and builds a b/w sprite:
But I just failed when I tried to insert another inner #FOR construction for making attributes.
I hoped it would be like this, but the answer is NO:
The only way to use attributes is very clumsy:
How could I solve it in a simple way
I'm trying to create .png of a sprite made of indexes. $DDF9 is the start adress of bytes with index #00
Spoiler
Code: Select all
b $7929 DESK WITH A CHAIR
B $7929,30,6
D $7929 #UDGARRAY#(6#FOR$7929,$7946,1||n|;(#PEEKn*9+$DDF9)||)(7929h)
It works fine, finds the appropriate bytes at the calculated addresses and builds a b/w sprite:
But I just failed when I tried to insert another inner #FOR construction for making attributes.
I hoped it would be like this, but the answer is NO:
Code: Select all
D $7929 #UDGARRAY#(6#FOR$7929,$7946,1||n|;(#PEEKn*9+$DDF9)||@#(#FOR$7929,$7946,1||n|;(#PEEKn*9+$DDF9+8)||(7929h)))
The only way to use attributes is very clumsy:
Code: Select all
D $7929 #UDGARRAY#(6#FOR$7929,$7946,1||n|;(#PEEKn*9+$DDF9)||@$DE01x2;$E1C4x2;$DE01x2;$E1D6x8;$E1C4x2;$E1D6x4;$DE01x2;$E1D6x2;$DE01x6(7929h))
Re: skoolkit generating sprites in html
It looks like you're pretty close already. Try this:
Code: Select all
#UDGARRAY#(6#FOR$7929,$7946,1||n|;(#PEEKn*9+$DDF9)||@#FOR$7929,$7946,1||n|(#PEEKn*9+$DDF9+8)|;||(7929h))
Re: skoolkit generating sprites in html
Thank you. You are a great master!
I was playing with that second half of the line in one way, then another, but had mistakes all the same(I'm a newbee to your Skoolkit yet)
Could I sometimes ask you more questions about using Skoolkit here later? Or is there a special Skoolkit forum somewhere?
I was playing with that second half of the line in one way, then another, but had mistakes all the same(I'm a newbee to your Skoolkit yet)
Could I sometimes ask you more questions about using Skoolkit here later? Or is there a special Skoolkit forum somewhere?
Re: skoolkit generating sprites in html
Sure. This is as good a place as any for asking questions about SkoolKit. There's no dedicated SkoolKit forum anywhere, unless someone created one without telling me about it.