 |
|
 |
|
| Posts by arnpoly |
|
|
|
Pages: 1 2  |
|
|
|
|
|
Has anyone worked with creating/modifying autoscroll sprite commands? What I'm trying to do is implement scrolling that gets faster when certain points of the level are reached. For starters, I'm trying to recreate very basic autoscrolling, but it just isn't working at all.
I know I'm way off base here, but I do appreciate any and all help.
Here's what code I have. It's pretty bad:
Code
dcb "INIT"
JSR SCROLL_INIT
RTL
dcb "MAIN"
PHB
PHK
PLB
JSR SPRITE_CODE_START
PLB
RTL
; Constants
SCREEN_X = $1A
SCROLL_SPEED = $B6
SCROLL_SPRITE_X = $E4
SCROLL_INIT LDA #$01
STA SCROLL_SPEED,x
RTS
SPRITE_CODE_START LDA $13
AND #$07
CMP #$00
BEQ RETURN
LDA SCREEN_X
CLC
ADC SCROLL_SPEED,x
STA SCREEN_X
RETURN RTS
|
|
|
|
|
|
I'm trying to take an existing 16x16 graphic and stretch it out as a 32x32. Is there a quick and reliable way to do that? Originally, I tried copying a 16x16 image from YY-CHR over to MS Paint to stretch it to 32x32, but when I copied it back to YY-CHR it screwed up the colors. Any help would be appreciated. Thanks.
|
|
|
|
|
I can certainly do that. I was hoping not to have to draw it out manually though. I'll give it a shot, thanks.
|
|
|
|
Pitching in to say this is a really great tutorial Iceguy and it has helped me a lot. There is still a bit missing though. Specifically I'd like to see more info about spawning and working with extended sprites. I'm starting to figure it out on my own for what I need but it would be a nice addition to the tutorial.
Originally posted by dahnamicsTrue. The only issues I'm having are on the 32X32 sprite. What type of clipping do you set in your .cfg file?
I've been using object clipping 7 and sprite clipping 2E, but in my sprite the collision detection on top is just a bit off. Still, it's a start.
|
|
|
|
I have an enemy sprite that spawns a custom flame sprite. The direction of the flame sprite is set via the Extra Property 1 byte in the enemy sprite code, but whenever the flame is created it defaults its direction to #$00 no matter what I set it to in the enemy sprite code.
I've posted my code below. Is there something I'm missing or doing wrong?
Code
FlameXDisp: db $10,$20 ; X displacement
FlameYDisp: db $08,$08 ; Y displacement
CreateFlamethrower:
JSL $02A9DE ; Get new sprite in y
BMI NoFlame
PHY
LDA !Direction,x ; Store new sprite direction in $00
EOR #$01
STA $00
TAY
LDA FlameXDisp,y ; Store X displacement to $01
STA $01
LDA FlameYDisp,y ; Store Y displacement to $02
STA $02
PLY
PHX
LDA $7FAB9E,x ; Sprite number of current sprite
INC A ; Increment to get sprite number of spawned
TYX
STA $7FAB9E,x ; Store sprite number for new sprite
LDA $00 ; Store direction in Extra Prop 1
STA $7FAB28,x
LDA #$01 ; Set Init status
STA $14C8,y
PLX
LDA $E4,x ; Get x position low byte
CLC ; Add X displacement
ADC $01
STA $00E4,y ; Set x position low byte
LDA $14E0,x ; Get x position high byte
ADC #$00 ; Add carry
STA $14E0,y ; Set X position high byte
LDA $D8,x ; Get y position low
CLC ; Add Y displacment
ADC $02
STA $00D8,y ; Set Y position low byte
LDA $14D4,x ; Get y position high byte
ADC #$00 ; Add carry
STA $14D4,y ; Set Y position high byte
PHX
TYX
JSL $07F7D2 ; Reset sprite tables
JSL $0187A7 ; Reset custom sprite tables
LDA #$08 ; Indicate we are generating a custom sprite
STA $7FAB10,x
PLX
NoFlame:
RTS
|
|
|
|
It's still not working for me. I tried moving the direction setting code under the reset subroutines like this:
CodeJSL $07F7D2 ; Reset sprite tables
JSL $0187A7 ; Reset custom sprite tables
LDA $00
STA $7FAB28,x
LDA #$08
STA $7FAB10,x ; This means we are generating a custom sprite
but it doesn't change anything. I also tried putting in a literal value and that doesn't take either.
This is an excerpt from the INIT routine of the flame sprite:
CodeLDA $7FAB28,x ; Extra property byte 1 contains direction
STA !Direction,x
I just don't understand what is overwriting that value. Any other advice?
|
|
|
|
I don't think that's the problem. I'm coping Y over to X so at this point in the code both X and Y should refer to the new sprite. (You have to use X for indexed long addressing.)
CodePHX
TYX
JSL $07F7D2 ; Reset sprite tables
JSL $0187A7 ; Reset custom sprite tables
LDA #$08 ; Indicate we are generating a custom sprite
STA $7FAB10,x
PLX
Both the enemy sprite and the spawned flame sprite are custom sprites I am developing. I really like the idea of using the first Extra Property byte to determine direction since my fire attack can be launched in four different directions. I can't wrap my brain around how else to work around it.
|
|
|
|
I am writing some code to check how many fire flowers are "active," and it seems to work fine except whenever a fire flower out of the item box falls off the bottom of the screen. In that case it permanently appears in the count when it should be destroyed by falling offscreen. I'm checking to see if the sprite status is not normal (8) but that doesn't seem to be enough. Any advice?
Here's the code for reference:
CodeGetFlowerCount:
LDY #$00
PHX
LDX #$0B
FlowerLoop:
LDA $9E,x
CMP #$75
BNE NotFlower
LDA $14C8,x
CMP #$08
BNE NotFlower
INY
NotFlower:
DEX
BPL FlowerLoop
PLX
LDA $19 ; \ Check if current powerup is a fire flower
CMP #$03 ; /
BNE CheckReserve
INY
CheckReserve:
LDA $0DC2 ; \ Check if reserve item is a fire flower
CMP #$02 ; /
BNE Finished
INY
Finished:
RTS
|
|
|
|
I'm not really sure what is going on here. =) It is like the item box sprite does not get changed at all after it is set to fall from the box. The best I can do is ignore the falling powerup from the count but I would prefer not to do that. Checking either $1534,x for $01 or $161A,x for $FF determines if it's the falling item or not, and $15C4,x, which I was sure would work, doesn't get set at all.
I also see if you drop multiple flowers out of the item box over the course of a level (though it might just be the same screen) they all count toward the flower count. I don't know at what point those sprite slots get freed up again if at all.
What I'll try to do next is check the Y position of the falling flower to check that way if it stays on screen. That's the only thing I can think of.
|
|
|
|
This is for a boss I'm making. It's meant to apply to a single screen room so in this particular case I don't have to worry about the other accounting stuff.
Checking the Y position did the trick, so I'm good for now. Thank you!
|
|
|
|
Finally figured out how to record a video of my custom boss! =) Check it out.
Piranha Boss
|
|
|
|
Originally posted by Ixtab
way cool. my *only* complaint is the attack at 0:49 with the fire that goes up and then down. it just looks weird to me. also, what happens if you don't have a fire flower? if it gives you another, then it would me you can't die, no? maybe have a mario-health system for the fight and have an 'always fire-mario' part in the sprite too. it's really nice though.
Thanks! I think the attack looks better when actually playing it. I couldn't come up with a better way visually for it to spit podoboos.
The boss drops fire flowers, and it will drop them more frequently if Mario doesn't already have a fire flower. I tried to balance it out the best I could. It's a pretty tough boss even with a bunch of fire flower drops. I think a health system for Mario makes sense too.
|
|
|
|
|
The call to $01ACF9 also leaves the value from $148D in the accumulator so you don't have to LDA $148D specifically afterwards (unless you need a 2-byte random value).
|
|
| Posted on 2011-04-26 07:59:05 PM in Lava |
Link |
|
Same technique as above. Cycle through all the sprites and check if the sprite is sinking in lava. If so, check if that sprite is $9B. The sprite number table is at $9E.
Remember, the RAM map is your friend.
|
|
|
|
Originally posted by Teo17
4. WDM opcode. Yes, I see it's not used and I know that it was reserved for future 16-bit opcodes. But what was it supposed to do at all, and what does WDM mean?
WDM is merely a placeholder opcode for expanded opcodes that have never been implemented. It acts like a two-byte NOP but you shouldn't use it that way because there is no reason to. WDM is named after William D. Mensch, Jr, the designer of the 65816 processor. =)
|
|
|
|
Originally posted by imameliaWhat would be a good way to generate a sequence of random numbers that contains each number exactly once? For instance, if I want a range of 00-1F, then the routine would output those 0x20 numbers in a random order, perhaps in a 0x20-byte-long RAM table. The output might be, say, "04 10 1A 0F 0C 16 18 1E 02 11 0D 1C 1F 03 07 15 14 00 05 1D 01 0E 12 19 0E 08 0B 17 06 1B 0A 13 09".
Conceptually, the best way I can think of is to start with an ordered list (00, 01, 02,...), randomly select two elements of the list, and swap them. Do that however many times you like and that should give you a decently randomized list.
|
|
|
|
While I do like Alcaro's method better than mine, there is a trade-off in that it is more difficult (in ASM anyway) to find a random value that isn't out of a power of 2. Choosing from 00-07 is easy (LDA RandomValue : AND #$07) but choosing from 01-07 requires a different and likely more complex method. I can't think of a good way to do that in ASM, but I would like to hear any ideas on that.
I think a good compromise is to take Alcaro's method of stepping through each element in the list but swap it with any element in the list, not just ones later in the list. That makes sure every element of the list has the chance to move out of its current spot in the list and has the added benefit of being easier to code.
EDIT: Fixed AND #$08 with the correct value #$07.
|
| Last edited on 2011-10-08 09:34:41 AM by arnpoly. |
|
|
|
This is tremendous work, Alcaro. I admit defeat. I'm pretty sure we've beat this to death now but this is a really good investigation that I believe is useful.
I'm genuinely curious though, what would be a good method of finding a random value from a range of numbers that isn't a power of 2? I had this come up awhile back when I needed to find a random value between 00-0B. What I did was look for a random value from 00-0F and throw the results out until I found a value in the range I needed. It worked and it provides a uniformly random value, but it just seemed inefficient to me. To me this is the only hurdle between coding Alcaro's method and our "hybrid" method.
Originally posted by Alcaro
...oh, and picking a random value from 00-07 is AND #$07, not AND #$08.
Oops, good catch. I edited my previous post to correct that.
|
|
|
|
I am having some trouble getting my custom sprite to spawn more than one custom sprite at a time. I can get one sprite to spawn very easily but the second one just doesn't load for some reason. If I try to spawn two, it only ends up creating one and after several more attempts the game slows down bad and eventually crashes. It's like the 2nd sprite is accounted for but it doesn't process right and doesn't show up at all on the screen. I've rewritten the function I think 3 times and I still haven't gotten anywhere. Does anyone know what the problem might be?
I also have another bonus question. When spawning a custom sprite, is there a way to skip its init routine? At the time it spawns I want to manually set up the sprite myself without the need for init. I have tried setting up all the variables created in the original init routine and then setting the sprite status to 08 but that crashes the game when I try that. And when it doesn't crash it still loads the original init routine and overwrites any changes I have made to the sprite tables.
The code is a tad long but I wanted to include everything. I appreciate any help I can get!
Code; NOTE: $00-$03 already contain the X/Y position I want to spawn these sprites at
SpawnChildren:
LDA !Size,x
DEC A
STA $0F
LDA #$00
STA $0E
LDY #$0B
.SpriteGenLoop
LDA $14C8,y
BNE .Next
PHX
LDA $7FAB9E,x
TYX
STA $7FAB9E,x
LDA #$01
STA $14C8,y
LDX $0E
LDA SpinyTableOffset,x
CLC
ADC $0F
TAX
LDA $00
CLC
ADC SpinyDispXLow,x
STA $00E4,y
LDA $01
ADC SpinyDispXHigh,x
STA $14E0,y
LDA $02
CLC
ADC SpinyDispYLow,x
STA $00D8,y
LDA $03
ADC SpinyDispYHigh,x
STA $14D4,y
TYX
JSL $07F7D2
JSL $0187A7
LDA #$08
STA $7FAB10,x
LDX $0E
LDA SpinySpeedX,x
STA $00B6,y
LDA SpinySpeedY,x
STA $00AA,y
LDA #$01
STA.w !Direction,y
PLX
DEC $0E
LDA $0E
BMI .DestroySpiny
.Next
DEY
CPY #$00
BPL .SpriteGenLoop
.DestroySpiny
STZ $14C8,x
LDA #$03
STA $1DF9
.Return
RTS
SpinyTableOffset: db $00,$03
SpinyDispXLow: db $E8,$D8,$C8
db $08,$08,$08
SpinyDispXHigh: db $FF,$FF,$FF
db $00,$00,$00
SpinyDispYLow: db $F0,$E8,$E0
db $F0,$E8,$E0
SpinyDispYHigh: db $FF,$FF,$FF
db $FF,$FF,$FF
SpinySpeedX: db $E8,$18
SpinySpeedY: db $C0,$C0
|
|
|
Pages: 1 2  |
|
|
|
|
|
|
|
 |
|
 |
The purpose of this site is not to distribute copyrighted material, but to honor one of our favourite games.
Copyright © 2005 - 2013 - SMW Central Legal Information - Link To UsTotal queries: 27
|
|
|
|