geschrieben am 03.01.2013 14:17:20
So ich nochmal! (Sorry für Doppelpost)
Eventuell habt ihr meine Frage im "Du suchst Custom Sprites/Blocks/Music oder Graphics? Hier! " Thread gelesen.
Falls ihr es noch nicht gelesen habt anzeigenSo ich mal wieder. Brauche diesmal einen bestimmten Block.
Er soll das (Normale) Level in ein Wasserlevel verwandeln (Das bekomme ich auch noch selbst hin) und dann einen Custom Generator (D0) spawnen.
Hoffe mir kann jemand helfen!

Ich hab selbst noch ein wenig rumprobiert und hab dank eines Blocks auf SMWC schonmal einen (wie ich finde) ganz guten Ansatz!
Der Block spawnt einen Custom Sprite und macht das Level zu einen Wasserlevel.
Hier mal der Code:
Code;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Custom Sprite ? Block
;
;Set it to act like tile 129
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
db $42
JMP MarioBelow : JMP MarioAbove : JMP MarioSide : JMP SpriteV : JMP SpriteH : JMP MarioCape : JMP MarioFireBall
JMP MarioTopCorner : JMP MarioHeadIn : JMP MarioBodyIn
MarioAbove:
MarioBelow:
MarioSide:
LDA #$03
STA $85
;/
JSR SetSpriteCoord1
LDA #$D0 ;Custom Sprite Number
JSR SpawnSprite
RTL
MarioCape:
MarioHeadIn:
MarioBodyIn:
MarioFireBall:
MarioTopCorner:
SpriteV:
SpriteH:
RTL
SpawnSprite:
PHX
PHP
SEP #$30
PHA
LDX #$0B
SpwnSprtTryAgain:
LDA $14C8,x ;Sprite Status Table
BEQ SpwnSprtSet
DEX
CPX #$FF
BEQ SpwnSprtClear
BRA SpwnSprtTryAgain
SpwnSprtClear:
DEC $1861
BPL SpwnSprtExist
LDA #$01
STA $1861
SpwnSprtExist:
LDA $1861
CLC
ADC #$0A
TAX
SpwnSprtSet:
STX $185E
LDA #$08
STA $14C8,x ;Sprite Status Table
PLA
STA $7FAB9E,x
JSL $07F7D2 ; reset sprite properties
JSL $0187A7 ; get table values for custom sprite
LDA #$88 ; mark as initialized
STA $7FAB10,x
INC $15A0,x ;"Sprite off screen" flag, horizontal
LDA $9A ;Sprite creation: X position (low)
STA $E4,x ;Sprite Xpos Low Byte
LDA $9B
STA $14E0,x ;Sprite Xpos High Byte
LDA $98 ;Sprite creation: Y position (low)
STA $D8,x ;Sprite Ypos Low Byte
LDA $99 ;Sprite creation: Y position (high)
STA $14D4,x ;Sprite Ypos High Byte
LDA #$3E
STA $1540,x ;Sprite Spin Jump Death Frame Counter
LDA #$D0
STA $AA,x ;Sprite Y Speed
LDA #$2C
STA $144C,x
LDA $190F,x ;Sprite Properties
BPL SpwnSprtProp
LDA #$10
STA $15AC,x
SpwnSprtProp:
PLP
PLX
RTS
SetSpriteCoord1:
PHP
REP #$20
LDA $98
AND #$FFF0
STA $98
LDA $9A
AND #$FFF0
STA $9A
PLP
RTS
Das Problem ist aber: Er spawnt nur normale Custom Sprites und keine Generatoren. (Sprich mein D0 klappt nicht)
Kann mir jemand diesen anpassen, so das er Generatoren spawnen kann, oder kann mir jemand meinen Generator zu einem Sprite basteln? (Hab es selbst probiert, allerdings nicht hinbekommen..)
Hier auch mal der Code:
Codeprint "INIT ",pc
print "MAIN ",pc
REP #$20 ;\ Set processor 16 bit
LDA #$0D02 ;| $4330 = $210D
STA $4330 ;| $4331 = Mode 02
LDA #$9E00 ;|
STA $4332 ;| Destination: $7F9E00
LDY #$7F ;| (low and high byte)
STY $4334 ;|
LDA #$0F02 ;| $4340 = $210F
STA $4340 ;| $4341 = Mode 02
LDA #$9E00 ;|
STA $4342 ;| Destination: $7F9F00
LDY #$7F ;| (low and high byte)
STY $4344 ;|
SEP #$20 ;/ Set processor 8 bit
LDA #$18 ;\ Enable HDMA
TSB $0D9F ;/ on channel 3,4
LDX #$00 ;\ Init of
LDY #$00 ;/ X and Y
SEP #$20 ;\ Set processor 8 bit
LDA $13 ;| Set speed of waves
LSR A ;| Adding more LSR A
LSR A ;| will make it slower
STA $00 ;/ Store in scratch RAM
PHB ;\ Push data bank
PHK ;| Push program bank
PLB ;/ Pull data bank
Wave_Loop:
LDA #$06 ;\ Set scanline height
STA $7F9E00,x ;| for each wave
STA $7F9F00,x
TYA ;| Transfer Y to A
ADC $00 ;| Add in scratch RAM
AND #$0F ;| and transfer #$0F bytes
PHY ;| Push Y
TAY ;/ Transfer A to Y
LDA.w Wave_Table,y ;\ Load in wave values
LSR A ;| half of waves only
CLC ;| Clear carry flag
ADC $1462 ;| Apply to layer 1
STA $7F9E01,x ;| X position low byte
LDA $1463 ;| And add nothing to
ADC #$00 ;| layer 1 X position
STA $7F9E02,x ;/ high byte
LDA.w Wave_Table,y ;\ Load in wave values
CLC ;| Clear carry flag
ADC $1466 ;| Apply to layer 2
STA $7F9F01,x ;| X position low byte
LDA $1467 ;| And add nothing to
ADC #$00 ;| layer 2 X position
STA $7F9F02,x ;/ high byte
PLY ;\ Pull Y
CPY #$25 ;| Compare with #$25 scanlines
BPL End_Wave ;| If bigger, end HDMA
INX ;| Increase X
INX ;| Increase X
INX ;| Increase X
INY ;| Increase Y
BRA Wave_Loop ;/ Do the loop
End_Wave:
PLB ;\ Pull data bank
LDA #$00 ;| End HMDA by writing
STA $7F9E03,x ;| #$00 here
STA $7F9F03,x
RTL ;/ Return
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Table Settings
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Wave_Table:
db $00
db $01
db $02
db $03
db $04
db $05
db $06
db $07
db $07
db $06
db $05
db $04
db $03
db $02
db $01
db $00
Hoffe man kann mir helfen..