mirror of
https://frontier.innolan.net/github/AmigaExamples.git
synced 2026-09-12 15:52:30 +00:00
first refactor towards multiple player sprites
This commit is contained in:
@@ -25,6 +25,14 @@ IMAGES=foreground.png \
|
|||||||
sprite_pig-5.png \
|
sprite_pig-5.png \
|
||||||
sprite_pig-6.png \
|
sprite_pig-6.png \
|
||||||
sprite_pig-7.png \
|
sprite_pig-7.png \
|
||||||
|
sprite_robot-0.png \
|
||||||
|
sprite_robot-1.png \
|
||||||
|
sprite_robot-2.png \
|
||||||
|
sprite_robot-3.png \
|
||||||
|
sprite_robot-4.png \
|
||||||
|
sprite_robot-5.png \
|
||||||
|
sprite_robot-6.png \
|
||||||
|
sprite_robot-7.png \
|
||||||
sprite_coin-0.png \
|
sprite_coin-0.png \
|
||||||
sprite_coin-1.png \
|
sprite_coin-1.png \
|
||||||
sprite_coin-2.png \
|
sprite_coin-2.png \
|
||||||
@@ -67,6 +75,9 @@ out/mpanel.bin: assets/mpanel.png
|
|||||||
out/sprite_pig-%.bin: out/sprite_pig-%.png
|
out/sprite_pig-%.bin: out/sprite_pig-%.png
|
||||||
$(IMAGECON) --input $< $(IMAGECON_ARGS) --colors 4 --output-bitplanes --output-palette --full-color-palette-file --output-palette-asm --output-palette --output-png --output-copperlist --output out/sprite_pig-$* --palette-offset 16 --use-palette=assets/pig.pal
|
$(IMAGECON) --input $< $(IMAGECON_ARGS) --colors 4 --output-bitplanes --output-palette --full-color-palette-file --output-palette-asm --output-palette --output-png --output-copperlist --output out/sprite_pig-$* --palette-offset 16 --use-palette=assets/pig.pal
|
||||||
|
|
||||||
|
out/sprite_robot-%.bin: out/sprite_robot-%.png
|
||||||
|
$(IMAGECON) --input $< $(IMAGECON_ARGS) --colors 4 --output-bitplanes --output-palette --full-color-palette-file --output-palette-asm --output-palette --output-png --output-copperlist --output out/sprite_robot-$* --palette-offset 16 --use-palette=assets/robot.pal
|
||||||
|
|
||||||
|
|
||||||
out/sprite_fallingPig-%.bin: out/sprite_fallingPig-%.png
|
out/sprite_fallingPig-%.bin: out/sprite_fallingPig-%.png
|
||||||
$(IMAGECON) --input $< $(IMAGECON_ARGS) --colors 4 --output-bitplanes --output-palette --full-color-palette-file --output-palette-asm --output-palette --output-png --output-copperlist --output out/sprite_fallingPig-$* --palette-offset 16 --use-palette=assets/pig.pal
|
$(IMAGECON) --input $< $(IMAGECON_ARGS) --colors 4 --output-bitplanes --output-palette --full-color-palette-file --output-palette-asm --output-palette --output-png --output-copperlist --output out/sprite_fallingPig-$* --palette-offset 16 --use-palette=assets/pig.pal
|
||||||
@@ -78,6 +89,9 @@ out/sprite_coin%.bin: out/sprite_coin%.png
|
|||||||
out/sprite_pig%.png: assets/assets.png
|
out/sprite_pig%.png: assets/assets.png
|
||||||
../tools/croppa/out/croppa --input=assets/assets.png --output=out/sprite_pig --width=16 --height=16 --rows=1 --cols=8 --dx=16 --dy=16 --x=192 --y=112
|
../tools/croppa/out/croppa --input=assets/assets.png --output=out/sprite_pig --width=16 --height=16 --rows=1 --cols=8 --dx=16 --dy=16 --x=192 --y=112
|
||||||
|
|
||||||
|
out/sprite_robot%.png: assets/assets.png
|
||||||
|
../tools/croppa/out/croppa --input=assets/assets.png --output=out/sprite_robot --width=16 --height=16 --rows=1 --cols=8 --dx=16 --dy=16 --x=192 --y=176
|
||||||
|
|
||||||
out/sprite_fallingPig%.png: assets/assets.png
|
out/sprite_fallingPig%.png: assets/assets.png
|
||||||
../tools/croppa/out/croppa --input=assets/assets.png --output=out/sprite_fallingPig --width=16 --height=16 --rows=1 --cols=5 --dx=16 --dy=16 --x=192 --y=128
|
../tools/croppa/out/croppa --input=assets/assets.png --output=out/sprite_fallingPig --width=16 --height=16 --rows=1 --cols=5 --dx=16 --dy=16 --x=192 --y=128
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,4 @@
|
|||||||
|
000 000 000 255
|
||||||
|
095 112 160 255
|
||||||
|
055 047 071 255
|
||||||
|
063 073 121 255
|
||||||
+5
-2
@@ -16,6 +16,7 @@
|
|||||||
xdef mapSize
|
xdef mapSize
|
||||||
xdef moving
|
xdef moving
|
||||||
xdef foregroundScrollPixels
|
xdef foregroundScrollPixels
|
||||||
|
|
||||||
|
|
||||||
byteMap:
|
byteMap:
|
||||||
dc.l Entry
|
dc.l Entry
|
||||||
@@ -149,7 +150,7 @@ GameLoop:
|
|||||||
bra GameLoop
|
bra GameLoop
|
||||||
|
|
||||||
Update:
|
Update:
|
||||||
jsr UpdatePig
|
jsr UpdatePlayer
|
||||||
|
|
||||||
.backgroundUpdates:
|
.backgroundUpdates:
|
||||||
add.l #BACKGROUND_SCROLL_PIXELS,backgroundScrollX
|
add.l #BACKGROUND_SCROLL_PIXELS,backgroundScrollX
|
||||||
@@ -680,7 +681,7 @@ playAreaCopperPalettePtr2:
|
|||||||
dc.l $fffffffe
|
dc.l $fffffffe
|
||||||
|
|
||||||
InstallSpriteColorPalette:
|
InstallSpriteColorPalette:
|
||||||
include "out/sprite_pig-0-palette.s"
|
jsr InstallPlayerColorPalette
|
||||||
include "out/sprite_coin-1-palette.s"
|
include "out/sprite_coin-1-palette.s"
|
||||||
rts
|
rts
|
||||||
|
|
||||||
@@ -773,6 +774,8 @@ InstallNextGreyPanelPalette:
|
|||||||
.done
|
.done
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
foregroundOnscreen:
|
foregroundOnscreen:
|
||||||
dc.l foregroundBitplanes1
|
dc.l foregroundBitplanes1
|
||||||
foregroundOffscreen:
|
foregroundOffscreen:
|
||||||
|
|||||||
+54
-76
@@ -1,6 +1,6 @@
|
|||||||
include "includes.i"
|
include "includes.i"
|
||||||
|
|
||||||
xdef UpdatePig
|
xdef UpdatePlayer
|
||||||
xdef ProcessJoystick
|
xdef ProcessJoystick
|
||||||
xdef InitialisePig
|
xdef InitialisePig
|
||||||
xdef HidePig
|
xdef HidePig
|
||||||
@@ -11,9 +11,17 @@
|
|||||||
xdef spriteLagX
|
xdef spriteLagX
|
||||||
xdef spriteY
|
xdef spriteY
|
||||||
xdef UpdatePigFallingAnimation
|
xdef UpdatePigFallingAnimation
|
||||||
|
xdef InstallPlayerColorPalette
|
||||||
|
|
||||||
|
PLAYER_INSTALL_COLOR_PALETTE equ 0
|
||||||
|
PLAYER_SPRITE_DATA equ 4
|
||||||
|
|
||||||
InitialisePig:
|
InitialisePig:
|
||||||
|
move.l playerSpriteConfig,a0
|
||||||
|
move.l PLAYER_SPRITE_DATA(a0),d0
|
||||||
|
add.l #6*PIG_SPRITE_VERTICAL_BYTES,d0
|
||||||
|
move.l d0,currentSprite
|
||||||
|
|
||||||
move.w #0,spritePigFallingAnimation
|
move.w #0,spritePigFallingAnimation
|
||||||
move.w #PIG_INITIAL_X,spriteX
|
move.w #PIG_INITIAL_X,spriteX
|
||||||
move.w #PIG_INITIAL_Y,spriteY
|
move.w #PIG_INITIAL_Y,spriteY
|
||||||
@@ -48,60 +56,69 @@ UpdatePigFallingAnimation:
|
|||||||
rts
|
rts
|
||||||
|
|
||||||
|
|
||||||
UpdatePig:
|
UpdatePlayer:
|
||||||
;; right
|
;; right
|
||||||
|
move.l playerSpriteConfig,a0
|
||||||
|
move.l PLAYER_SPRITE_DATA(a0),d0
|
||||||
cmp.w #PIG_PAUSE_PIXELS,spriteR
|
cmp.w #PIG_PAUSE_PIXELS,spriteR
|
||||||
ble .skipRight
|
ble .skipRight
|
||||||
add.w #PIG_MOVE_PIXELS,spriteX
|
add.w #PIG_MOVE_PIXELS,spriteX
|
||||||
move.l #spritePigRightJump,currentSprite
|
add.l #7*PIG_SPRITE_VERTICAL_BYTES,d0
|
||||||
|
move.l d0,currentSprite
|
||||||
.skipRight
|
.skipRight
|
||||||
cmp.w #0,spriteR
|
cmp.w #0,spriteR
|
||||||
beq .notRight
|
beq .notRight
|
||||||
sub.w #1,spriteR
|
sub.w #1,spriteR
|
||||||
cmp.w #PIG_PAUSE_PIXELS,spriteR
|
cmp.w #PIG_PAUSE_PIXELS,spriteR
|
||||||
bge .notRight
|
bge .notRight
|
||||||
move.l #spritePigRight,currentSprite
|
add.l #6*PIG_SPRITE_VERTICAL_BYTES,d0
|
||||||
|
move.l d0,currentSprite
|
||||||
.notRight:
|
.notRight:
|
||||||
;; up
|
;; up
|
||||||
cmp.w #PIG_PAUSE_PIXELS,spriteU
|
cmp.w #PIG_PAUSE_PIXELS,spriteU
|
||||||
ble .skipUp
|
ble .skipUp
|
||||||
sub.w #PIG_MOVE_PIXELS,spriteY
|
sub.w #PIG_MOVE_PIXELS,spriteY
|
||||||
sub.w #PIG_MOVE_PIXELS,spriteYEnd
|
sub.w #PIG_MOVE_PIXELS,spriteYEnd
|
||||||
move.l #spritePigUpJump,currentSprite
|
add.l #1*PIG_SPRITE_VERTICAL_BYTES,d0
|
||||||
|
move.l d0,currentSprite
|
||||||
.skipUp:
|
.skipUp:
|
||||||
cmp.w #0,spriteU
|
cmp.w #0,spriteU
|
||||||
beq .notUp
|
beq .notUp
|
||||||
sub.w #1,spriteU
|
sub.w #1,spriteU
|
||||||
cmp.w #PIG_PAUSE_PIXELS,spriteU
|
cmp.w #PIG_PAUSE_PIXELS,spriteU
|
||||||
bge .notUp
|
bge .notUp
|
||||||
move.l #spritePigUp,currentSprite
|
move.l d0,currentSprite
|
||||||
.notUp:
|
.notUp:
|
||||||
;; down
|
;; down
|
||||||
cmp.w #PIG_PAUSE_PIXELS,spriteD
|
cmp.w #PIG_PAUSE_PIXELS,spriteD
|
||||||
ble .skipDown
|
ble .skipDown
|
||||||
add.w #PIG_MOVE_PIXELS,spriteY
|
add.w #PIG_MOVE_PIXELS,spriteY
|
||||||
add.w #PIG_MOVE_PIXELS,spriteYEnd
|
add.w #PIG_MOVE_PIXELS,spriteYEnd
|
||||||
move.l #spritePigDownJump,currentSprite
|
add.l #3*PIG_SPRITE_VERTICAL_BYTES,d0
|
||||||
|
move.l d0,currentSprite
|
||||||
.skipDown:
|
.skipDown:
|
||||||
cmp.w #0,spriteD
|
cmp.w #0,spriteD
|
||||||
beq .notDown
|
beq .notDown
|
||||||
sub.w #1,spriteD
|
sub.w #1,spriteD
|
||||||
cmp.w #PIG_PAUSE_PIXELS,spriteD
|
cmp.w #PIG_PAUSE_PIXELS,spriteD
|
||||||
bge .notDown
|
bge .notDown
|
||||||
move.l #spritePigDown,currentSprite
|
add.l #2*PIG_SPRITE_VERTICAL_BYTES,d0
|
||||||
|
move.l d0,currentSprite
|
||||||
.notDown:
|
.notDown:
|
||||||
;; left
|
;; left
|
||||||
cmp.w #PIG_PAUSE_PIXELS,spriteL
|
cmp.w #PIG_PAUSE_PIXELS,spriteL
|
||||||
ble .skipLeft
|
ble .skipLeft
|
||||||
sub.w #PIG_MOVE_PIXELS,spriteX
|
sub.w #PIG_MOVE_PIXELS,spriteX
|
||||||
move.l #spritePigLeftJump,currentSprite
|
add.l #5*PIG_SPRITE_VERTICAL_BYTES,d0
|
||||||
|
move.l d0,currentSprite
|
||||||
.skipLeft
|
.skipLeft
|
||||||
cmp.w #0,spriteL
|
cmp.w #0,spriteL
|
||||||
beq .notLeft
|
beq .notLeft
|
||||||
sub.w #1,spriteL
|
sub.w #1,spriteL
|
||||||
cmp.w #PIG_PAUSE_PIXELS,spriteL
|
cmp.w #PIG_PAUSE_PIXELS,spriteL
|
||||||
bge .notLeft
|
bge .notLeft
|
||||||
move.l #spritePigLeft,currentSprite
|
add.l #4*PIG_SPRITE_VERTICAL_BYTES,d0
|
||||||
|
move.l d0,currentSprite
|
||||||
.notLeft:
|
.notLeft:
|
||||||
cmp.w #$cf,spriteX
|
cmp.w #$cf,spriteX
|
||||||
blt .noScroll
|
blt .noScroll
|
||||||
@@ -176,73 +193,34 @@ SetupSpriteData:
|
|||||||
move.l #deadSprite,SPR6PTH(a6)
|
move.l #deadSprite,SPR6PTH(a6)
|
||||||
move.l #deadSprite,SPR7PTH(a6)
|
move.l #deadSprite,SPR7PTH(a6)
|
||||||
rts
|
rts
|
||||||
|
|
||||||
|
InstallPlayerColorPalette:
|
||||||
|
move.l playerSpriteConfig,a0
|
||||||
|
move.l PLAYER_INSTALL_COLOR_PALETTE(a0),a1
|
||||||
|
jsr (a1)
|
||||||
|
rts
|
||||||
|
|
||||||
|
InstallPigColorPalette:
|
||||||
spritePigUp:
|
include "out/sprite_pig-0-palette.s"
|
||||||
dc.w 0,0
|
rts
|
||||||
dc.w 0,0
|
|
||||||
incbin "out/sprite_pig-1.bin" ; up
|
InstallRobotColorPalette:
|
||||||
dc.l 0
|
include "out/sprite_robot-0-palette.s"
|
||||||
spritePigUpJump:
|
rts
|
||||||
dc.w 0,0
|
|
||||||
dc.w 0,0
|
pigPlayerSpriteConfig:
|
||||||
incbin "out/sprite_pig-0.bin" ; up jump
|
dc.l InstallPigColorPalette
|
||||||
dc.l 0
|
dc.l spritePig
|
||||||
spritePigDown:
|
|
||||||
dc.w 0,0
|
robotPlayerSpriteConfig:
|
||||||
dc.w 0,0
|
dc.l InstallRobotColorPalette
|
||||||
incbin "out/sprite_pig-5.bin" ; down
|
dc.l spriteRobot
|
||||||
dc.l 0
|
|
||||||
spritePigDownJump:
|
playerSpriteConfig:
|
||||||
dc.w 0,0
|
dc.l robotPlayerSpriteConfig
|
||||||
dc.w 0,0
|
|
||||||
incbin "out/sprite_pig-4.bin" ; down jump
|
include "sprite_data.i"
|
||||||
dc.l 0
|
|
||||||
spritePigLeft:
|
|
||||||
dc.w 0,0
|
|
||||||
dc.w 0,0
|
|
||||||
incbin "out/sprite_pig-7.bin" ; left
|
|
||||||
dc.l 0
|
|
||||||
spritePigLeftJump:
|
|
||||||
dc.w 0,0
|
|
||||||
dc.w 0,0
|
|
||||||
incbin "out/sprite_pig-6.bin" ; left jump
|
|
||||||
dc.l 0
|
|
||||||
spritePigRight:
|
|
||||||
dc.w 0,0
|
|
||||||
dc.w 0,0
|
|
||||||
incbin "out/sprite_pig-3.bin" ; right
|
|
||||||
dc.l 0
|
|
||||||
spritePigRightJump:
|
|
||||||
dc.w 0,0
|
|
||||||
dc.w 0,0
|
|
||||||
incbin "out/sprite_pig-2.bin" ; right jump
|
|
||||||
dc.l 0
|
|
||||||
spriteFalling0:
|
|
||||||
dc.w 0,0
|
|
||||||
dc.w 0,0
|
|
||||||
incbin "out/sprite_fallingPig-0.bin"
|
|
||||||
dc.l 0
|
|
||||||
spriteFalling1:
|
|
||||||
dc.w 0,0
|
|
||||||
dc.w 0,0
|
|
||||||
incbin "out/sprite_fallingPig-1.bin"
|
|
||||||
dc.l 0
|
|
||||||
spriteFalling2:
|
|
||||||
dc.w 0,0
|
|
||||||
dc.w 0,0
|
|
||||||
incbin "out/sprite_fallingPig-2.bin"
|
|
||||||
dc.l 0
|
|
||||||
spriteFalling3:
|
|
||||||
dc.w 0,0
|
|
||||||
dc.w 0,0
|
|
||||||
incbin "out/sprite_fallingPig-3.bin"
|
|
||||||
dc.l 0
|
|
||||||
spriteFalling4:
|
|
||||||
dc.w 0,0
|
|
||||||
dc.w 0,0
|
|
||||||
incbin "out/sprite_fallingPig-4.bin"
|
|
||||||
dc.l 0
|
|
||||||
spritePigFallingAnimation:
|
spritePigFallingAnimation:
|
||||||
dc.w 0
|
dc.w 0
|
||||||
currentSpriteOffset:
|
currentSpriteOffset:
|
||||||
|
|||||||
@@ -0,0 +1,110 @@
|
|||||||
|
spritePig:
|
||||||
|
spritePigUp:
|
||||||
|
dc.w 0,0
|
||||||
|
dc.w 0,0
|
||||||
|
incbin "out/sprite_pig-1.bin" ; 0, up
|
||||||
|
dc.l 0
|
||||||
|
spritePigUpJump:
|
||||||
|
dc.w 0,0
|
||||||
|
dc.w 0,0
|
||||||
|
incbin "out/sprite_pig-0.bin" ; 1, up jump
|
||||||
|
dc.l 0
|
||||||
|
spritePigDown:
|
||||||
|
dc.w 0,0
|
||||||
|
dc.w 0,0
|
||||||
|
incbin "out/sprite_pig-5.bin" ; 2, down
|
||||||
|
dc.l 0
|
||||||
|
spritePigDownJump:
|
||||||
|
dc.w 0,0
|
||||||
|
dc.w 0,0
|
||||||
|
incbin "out/sprite_pig-4.bin" ; 3, down jump
|
||||||
|
dc.l 0
|
||||||
|
spritePigLeft:
|
||||||
|
dc.w 0,0
|
||||||
|
dc.w 0,0
|
||||||
|
incbin "out/sprite_pig-7.bin" ; 4, left
|
||||||
|
dc.l 0
|
||||||
|
spritePigLeftJump:
|
||||||
|
dc.w 0,0
|
||||||
|
dc.w 0,0
|
||||||
|
incbin "out/sprite_pig-6.bin" ; 5, left jump
|
||||||
|
dc.l 0
|
||||||
|
spritePigRight:
|
||||||
|
dc.w 0,0
|
||||||
|
dc.w 0,0
|
||||||
|
incbin "out/sprite_pig-3.bin" ; 6, right
|
||||||
|
dc.l 0
|
||||||
|
spritePigRightJump:
|
||||||
|
dc.w 0,0
|
||||||
|
dc.w 0,0
|
||||||
|
incbin "out/sprite_pig-2.bin" ; 7, right jump
|
||||||
|
dc.l 0
|
||||||
|
|
||||||
|
|
||||||
|
spriteRobot:
|
||||||
|
spriteRobotUp:
|
||||||
|
dc.w 0,0
|
||||||
|
dc.w 0,0
|
||||||
|
incbin "out/sprite_robot-1.bin" ; 0, up
|
||||||
|
dc.l 0
|
||||||
|
spriteRobotUpJump:
|
||||||
|
dc.w 0,0
|
||||||
|
dc.w 0,0
|
||||||
|
incbin "out/sprite_robot-0.bin" ; 1, up jump
|
||||||
|
dc.l 0
|
||||||
|
spriteRobotDown:
|
||||||
|
dc.w 0,0
|
||||||
|
dc.w 0,0
|
||||||
|
incbin "out/sprite_robot-5.bin" ; 2, down
|
||||||
|
dc.l 0
|
||||||
|
spriteRobotDownJump:
|
||||||
|
dc.w 0,0
|
||||||
|
dc.w 0,0
|
||||||
|
incbin "out/sprite_robot-4.bin" ; 3, down jump
|
||||||
|
dc.l 0
|
||||||
|
spriteRobotLeft:
|
||||||
|
dc.w 0,0
|
||||||
|
dc.w 0,0
|
||||||
|
incbin "out/sprite_robot-7.bin" ; 4, left
|
||||||
|
dc.l 0
|
||||||
|
spriteRobotLeftJump:
|
||||||
|
dc.w 0,0
|
||||||
|
dc.w 0,0
|
||||||
|
incbin "out/sprite_robot-6.bin" ; 5, left jump
|
||||||
|
dc.l 0
|
||||||
|
spriteRobotRight:
|
||||||
|
dc.w 0,0
|
||||||
|
dc.w 0,0
|
||||||
|
incbin "out/sprite_robot-3.bin" ; 6, right
|
||||||
|
dc.l 0
|
||||||
|
spriteRobotRightJump:
|
||||||
|
dc.w 0,0
|
||||||
|
dc.w 0,0
|
||||||
|
incbin "out/sprite_robot-2.bin" ; 7, right jump
|
||||||
|
dc.l 0
|
||||||
|
|
||||||
|
spriteFalling0:
|
||||||
|
dc.w 0,0
|
||||||
|
dc.w 0,0
|
||||||
|
incbin "out/sprite_fallingPig-0.bin"
|
||||||
|
dc.l 0
|
||||||
|
spriteFalling1:
|
||||||
|
dc.w 0,0
|
||||||
|
dc.w 0,0
|
||||||
|
incbin "out/sprite_fallingPig-1.bin"
|
||||||
|
dc.l 0
|
||||||
|
spriteFalling2:
|
||||||
|
dc.w 0,0
|
||||||
|
dc.w 0,0
|
||||||
|
incbin "out/sprite_fallingPig-2.bin"
|
||||||
|
dc.l 0
|
||||||
|
spriteFalling3:
|
||||||
|
dc.w 0,0
|
||||||
|
dc.w 0,0
|
||||||
|
incbin "out/sprite_fallingPig-3.bin"
|
||||||
|
dc.l 0
|
||||||
|
spriteFalling4:
|
||||||
|
dc.w 0,0
|
||||||
|
dc.w 0,0
|
||||||
|
incbin "out/sprite_fallingPig-4.bin"
|
||||||
|
dc.l 0
|
||||||
Reference in New Issue
Block a user