Jump to content
Lillapojkenpåön

DPC+ question

Recommended Posts

Is it possible to put all the animations of a sprite into one long sprite and change the pointer to which line to start reading from like I've seen done in the standard kernel? And would the sprite be limited to 255 lines tall then?

 

Here's an example to copy and add to, let's say I added 5 to the variable f every frame and wanted that to be the offset, what would that look like?

asm
LDX #<mytext1
STX player0pointerlo
LDA #((>mytext1) & $0f) | (((>mytext1) / 2) & $70)
STA player0pointerhi
end

Share this post


Link to post
Share on other sites

nevermind, this worked

 

asm
LDA #<mytext1
STA temp5
end
player0pointerlo = temp5 + f
asm
LDA #((>mytext1) & $0f) | (((>mytext1) / 2) & $70)
STA player0pointerhi
end
Edited by Lillapojkenpåön
  • Like 1

Share this post


Link to post
Share on other sites

I can only speak for the DPC+ kernel, I have quite a bit of animation in my game and before I was using "on goto" to jump to the sprites and "goto" to jump back to the loop again,

and the regular way to load a sprite in bB like this.. (that I was jumping to and from..)

 

player0:
%11000000
%11000000
%11000000
%11000000
end

outputs something like this when assembled, except the automaticly generated name playerL02841_0 will be different

 

LDX #<playerL02841_0
STX player0pointerlo
LDA #((>playerL02841_0) & $0f) | (((>playerL02841_0) / 2) & $70)
STA player0pointerhi
LDA #5
STA player0height
and it puts the graphic in the graphics bank
playerL02841_0
.byte %11000000
.byte %11000000
.byte %11000000
.byte %11000000
.byte %11000000

 

That's alot of duplicate code when the animation frames start adding up, if you can just use the same code and a tall sprite and a counter that make it works more like a filmstrip.

I saved cycles and 3000 bytes (not counting the graphics bank) so it was very beneficial.

 

It looks complicated to me to :) i have no Idea what #((>playerL02841_0) & $0f) | (((>playerL02841_0) / 2) & $70) does or even what pointers do exactly, the nice thing is that you don't have to to still get it to work. :)

Edited by Lillapojkenpåön
  • Like 1

Share this post


Link to post
Share on other sites

 

nevermind, this worked

 

asm
LDA #<mytext1
STA temp5
end
player0pointerlo = temp5 + f
asm
LDA #((>mytext1) & $0f) | (((>mytext1) / 2) & $70)
STA player0pointerhi
end

 

 

Where did the magical math come from? I should probably put a version of this on the bB page and link to the source of the information. Also, can "mytext1" be called anything the programmer wants?

Share this post


Link to post
Share on other sites

Yes it can be called anything, I made an example you can play around with, it uses playerheight instead of deathbits

 

example.bas

 

press up down left or right to blow the robots up, and fire to reset them

Edited by Lillapojkenpåön
  • Like 3

Share this post


Link to post
Share on other sites

Yes it can be called anything, I made an example you can play around with, it uses playerheight instead of deathbits

 

attachicon.gifexample.bas

 

press up down left or right to blow the robots up, and fire to reset them

 

It compiles, but Stella doesn't come up when I try to run it. I'm guessing that I need to upgrade Stella.

Share this post


Link to post
Share on other sites

I'm using 4.6, so maybe that's the problem.

 

This is annoying. I downloaded Visual C++ Redistributable for Visual Studio 2017 (vc_redist.x64.exe) and Stella-5.1.3-x64.exe and now Stella won't even run. I get this pop up message:

 

post-13-0-74972400-1537980025.png

Share this post


Link to post
Share on other sites

Did you get the x64 version of the runtime? If you got the x86 version, then that might explain why it can't find it (32-bit version).

  • Like 1

Share this post


Link to post
Share on other sites

Did you get the x64 version of the runtime? If you got the x86 version, then that might explain why it can't find it (32-bit version).

 

Yep, the x64 version.

Share this post


Link to post
Share on other sites

HI,

 

I'm currently working on a platform game for DPC+ and have a lot of animation for the player - this is exactly what i'm looking for to create a animation engine to go with it.

 

One question - how can I change the pointer to another set of animations ie. moving, jumping, falling etc. I've played around with diming a variable and referencing a starting animation and then changing that variable to another animation in data but it doesn't change - i'm assuming the compiler maybe hard-coding this into the asm which would in some ways make an animation engine reasonably difficult.

 

Anyone who better understands pointers have any ideas? In the end I could load up all animation into one only data reference I guess...

 

Update: Maybe some further info here as well - maybe not possible to have separate animations

http://atariage.com/forums/topic/256849-re-use-player-sprites-without-duplication-dpc

 

Thanks!

Edited by mksmith

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...