mirror of
https://frontier.innolan.net/github/AmigaExamples.git
synced 2026-09-12 14:31:57 +00:00
pig falling animation
This commit is contained in:
@@ -29,6 +29,11 @@ IMAGES=foreground.png \
|
||||
sprite_coin-1.png \
|
||||
sprite_coin-2.png \
|
||||
sprite_coin-3.png\
|
||||
sprite_fallingPig-0.png \
|
||||
sprite_fallingPig-1.png \
|
||||
sprite_fallingPig-2.png \
|
||||
sprite_fallingPig-3.png \
|
||||
sprite_fallingPig-4.png \
|
||||
font8x8.png\
|
||||
splash.png
|
||||
|
||||
@@ -62,12 +67,20 @@ out/mpanel.bin: assets/mpanel.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
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
||||
out/sprite_coin%.bin: out/sprite_coin%.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_coin$* --palette-offset 20 --use-palette=assets/coin.pal
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
out/sprite_coin%.png: assets/assets.png
|
||||
../tools/croppa/out/croppa --input=assets/assets.png --output=out/sprite_coin --width=16 --height=15 --rows=1 --cols=4 --dx=16 --dy=16 --x=192 --y=144
|
||||
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 9.4 KiB After Width: | Height: | Size: 9.9 KiB |
@@ -7,6 +7,7 @@ PIG_INITIAL_Y equ $e4
|
||||
PIG_JUMP_PIXELS equ 8
|
||||
PIG_PAUSE_PIXELS equ 16
|
||||
PIG_MOVE_PIXELS equ 2
|
||||
PIG_SPRITE_VERTICAL_BYTES equ ((16*4)+12)
|
||||
|
||||
FOREGROUND_DELAY_BIT equ 0
|
||||
|
||||
@@ -40,6 +41,10 @@ ITEM_STRUCT_SIZE equ 16
|
||||
ITEM_STRUCT_MULU_SHIFT equ 4
|
||||
ITEM_NUM_COIN_ANIMS equ 7
|
||||
|
||||
|
||||
BIGBANG_ANIM_DELAY equ 4
|
||||
BIGBANG_POST_DELAY equ 15
|
||||
|
||||
SCREEN_WIDTH equ 320
|
||||
SCREEN_HEIGHT equ 256
|
||||
SCREEN_WIDTH_BYTES equ (SCREEN_WIDTH/8)
|
||||
|
||||
+21
-22
@@ -60,21 +60,22 @@ Entry:
|
||||
jsr InstallSpriteColorPalette
|
||||
|
||||
|
||||
|
||||
move.w #(DMAF_SPRITE|DMAF_BLITTER|DMAF_SETCLR!DMAF_COPPER!DMAF_RASTER!DMAF_MASTER),DMACON(a6)
|
||||
|
||||
|
||||
Reset:
|
||||
move.w #0,moving
|
||||
move.l #fade,fadePtr
|
||||
move.l #panelFade,panelFadePtr
|
||||
bsr InitAnimPattern
|
||||
;; jsr CleaDeAnimPattern
|
||||
jsr ResetBigBangPattern
|
||||
move.l #0,foregroundScrollX
|
||||
move.l #0,backgroundScrollX
|
||||
move.l #-1,frameCount
|
||||
bsr InitAnimPattern
|
||||
jsr ResetBigBangPattern
|
||||
jsr BlueFill
|
||||
jsr Message
|
||||
move.l #-1,frameCount
|
||||
jsr InstallGreyPalette
|
||||
jsr HidePig
|
||||
|
||||
MainLoop:
|
||||
MOVE.W #$0024,BPLCON2(a6)
|
||||
@@ -111,8 +112,8 @@ FadeInLoop:
|
||||
bsr InstallNextGreyPalette
|
||||
cmp.l #FOREGROUND_PLAYAREA_WIDTH_WORDS+25,d6
|
||||
bne .c1
|
||||
move.w #(DMAF_SPRITE|DMAF_BLITTER|DMAF_SETCLR!DMAF_COPPER!DMAF_RASTER!DMAF_MASTER),DMACON(a6)
|
||||
jsr InitialisePig
|
||||
jsr EnableItemSprites
|
||||
bra GameLoop
|
||||
.c1:
|
||||
bra FadeInLoop
|
||||
@@ -338,70 +339,67 @@ RenderForegroundTile:
|
||||
|
||||
|
||||
PostMissedTile:
|
||||
jsr InstallGreyPalette
|
||||
jsr ResetItems
|
||||
jsr HidePig
|
||||
move.w #MPANEL_COPPER_WAIT,mpanelWaitLinePtr
|
||||
bra Reset
|
||||
|
||||
|
||||
CheckPigMiss:
|
||||
lea map,a2
|
||||
|
||||
;; calculate the a2 offset of the top right tile based on foreground scroll
|
||||
move.l foregroundScrollX,d0
|
||||
lsr.l #FOREGROUND_SCROLL_TILE_INDEX_CONVERT,d0
|
||||
lsr.l #1,d0
|
||||
|
||||
and.b #$f0,d0
|
||||
add.l d0,a2
|
||||
|
||||
Offset:
|
||||
|
||||
|
||||
;; add the offset based on the sprite's x position
|
||||
move.w spriteLagX,d0
|
||||
sub.w #PIG_INITIAL_X,d0
|
||||
lsr.w #4,d0 ; x columns
|
||||
|
||||
BlahX:
|
||||
|
||||
move.l #(FOREGROUND_PLAYAREA_WIDTH_WORDS/2)-1,d1
|
||||
sub.w d0,d1
|
||||
mulu.w #FOREGROUND_PLAYAREA_HEIGHT_WORDS*2,d1
|
||||
sub.l d1,a2 ; pig x if y == bottom ?
|
||||
|
||||
|
||||
;; add the offset based on the sprite's y postion
|
||||
move.w #PIG_INITIAL_Y,d0
|
||||
sub.w spriteY,d0
|
||||
lsr.w #4,d0 ; y columns
|
||||
add.w #1,d0
|
||||
|
||||
BlahY:
|
||||
sub.l d1,d1
|
||||
move.w #FOREGROUND_PLAYAREA_HEIGHT_WORDS-1,d1
|
||||
sub.w d0,d1
|
||||
lsl.w #1,d1
|
||||
add.l d1,a2
|
||||
|
||||
;; a2 now points at the tile under the sprite
|
||||
move.w (a2),d0
|
||||
|
||||
;;
|
||||
cmp.w #$78e,d0
|
||||
blt BigBang
|
||||
.skip:
|
||||
|
||||
rts
|
||||
|
||||
|
||||
BigBang:
|
||||
move.w #(DMAF_SPRITE),DMACON(a6) ; turn sprites off for now
|
||||
;; move.w #(DMAF_SPRITE),DMACON(a6) ; turn sprites off for now
|
||||
|
||||
jsr ResetItems
|
||||
move.w #0,moving
|
||||
move.l #0,frameCount
|
||||
.bigBangLoop:
|
||||
add.l #1,frameCount
|
||||
cmp.l #10,frameCount
|
||||
cmp.l #BIGBANG_POST_DELAY,frameCount
|
||||
beq PostMissedTile
|
||||
move.l frameCount,d6
|
||||
jsr WaitVerticalBlank
|
||||
bsr HoriScrollPlayfield
|
||||
jsr SwitchBuffers
|
||||
jsr ProcessJoystick
|
||||
jsr UpdatePigFallingAnimation
|
||||
;; bsr Update
|
||||
|
||||
lea map,a2
|
||||
@@ -423,7 +421,7 @@ BigBang:
|
||||
|
||||
move.l #(FOREGROUND_PLAYAREA_WIDTH_WORDS/2),d5
|
||||
|
||||
move.l #4,d0
|
||||
move.l #BIGBANG_ANIM_DELAY,d0
|
||||
|
||||
lea bigBangIndex,a4
|
||||
.loop3:
|
||||
@@ -552,6 +550,7 @@ Message:
|
||||
move.w #128,d0
|
||||
move.w #11,d1
|
||||
jsr DrawText8
|
||||
move.w #MPANEL_COPPER_WAIT,mpanelWaitLinePtr
|
||||
rts
|
||||
|
||||
|
||||
|
||||
+18
-2
@@ -4,6 +4,7 @@
|
||||
xdef ScrollItemSprites
|
||||
xdef RenderItemSprite
|
||||
xdef ResetItems
|
||||
xdef EnableItemSprites
|
||||
|
||||
ScrollItemSprites:
|
||||
move.w #ITEM_NUM_SLOTS-1,d1
|
||||
@@ -35,6 +36,7 @@ ResetItems:
|
||||
move.w ITEM_Y(a1),d2
|
||||
add.l #ITEM_STRUCT_SIZE,a1 ; multiply by 16 (item control structure size)
|
||||
dbra d1,.loop1
|
||||
move.l #0,itemSpritesEnabled
|
||||
rts
|
||||
|
||||
ClearItemSpriteData:
|
||||
@@ -93,6 +95,10 @@ SetupItemSpriteData:
|
||||
move.w ITEM_LAGX(a1),d0
|
||||
lsr.w #FOREGROUND_SCROLL_SHIFT_CONVERT,d0 ; convert to pixels
|
||||
move.w ITEM_X(a1),ITEM_LAGX(a1)
|
||||
|
||||
cmp.l #0,itemSpritesEnabled
|
||||
beq .dontEnable
|
||||
|
||||
add.w #32,d0
|
||||
move.w d0,d1
|
||||
andi #1,d1
|
||||
@@ -103,7 +109,11 @@ SetupItemSpriteData:
|
||||
.c1:
|
||||
sub.l d2,a0 ;#1*ITEM_SPRITE_VERTICAL_BYTES,a0
|
||||
move.l a0,SPR2PTH(a6)
|
||||
bra .done
|
||||
.dontEnable:
|
||||
move.l #deadSprite,SPR2PTH(a6)
|
||||
|
||||
.done:
|
||||
add.w #1,ITEM_INDEX(a1)
|
||||
move.l (sp)+,d0
|
||||
rts
|
||||
@@ -115,14 +125,13 @@ RenderItemSprite:
|
||||
move.l foregroundScrollX,d1
|
||||
lsr.w #FOREGROUND_SCROLL_SHIFT_CONVERT,d1 ; convert to pixels
|
||||
andi.w #$f,d1
|
||||
cmp.b #$f,d1
|
||||
cmp.b #$f,d1 ; only add sprite after tile has scrolled in
|
||||
bne dontAddSprite
|
||||
move.l a2,a3
|
||||
add.l mapSize,a3
|
||||
cmpi.w #0,(a3)
|
||||
beq dontAddSprite
|
||||
|
||||
|
||||
GetSpriteSlot:
|
||||
move.w (a3),d0 ; sprite slot
|
||||
sub.w #1,d0
|
||||
@@ -146,6 +155,13 @@ dontAddSprite:
|
||||
movem.l (sp)+,d2-d3
|
||||
rts
|
||||
|
||||
EnableItemSprites:
|
||||
move.l #1,itemSpritesEnabled
|
||||
rts
|
||||
|
||||
itemSpritesEnabled:
|
||||
dc.l 0
|
||||
;; used for animation
|
||||
currentItemSprite:
|
||||
dc.l deadSprite
|
||||
|
||||
|
||||
+53
-5
@@ -10,23 +10,45 @@
|
||||
xdef spriteX
|
||||
xdef spriteLagX
|
||||
xdef spriteY
|
||||
|
||||
xdef UpdatePigFallingAnimation
|
||||
|
||||
|
||||
InitialisePig:
|
||||
move.w #0,spritePigFallingAnimation
|
||||
move.w #PIG_INITIAL_X,spriteX
|
||||
move.w #PIG_INITIAL_Y,spriteY
|
||||
move.w #PIG_INITIAL_Y+16,spriteYEnd
|
||||
rts
|
||||
|
||||
|
||||
HidePig:
|
||||
move.w #$f000,spriteX
|
||||
rts
|
||||
|
||||
|
||||
|
||||
ScrollSprites:
|
||||
sub.w #1,spriteX
|
||||
bra ScrollItemSprites
|
||||
rts
|
||||
|
||||
UpdatePig:
|
||||
|
||||
|
||||
UpdatePigFallingAnimation:
|
||||
move.w spritePigFallingAnimation,d0
|
||||
lsr.w #1,d0
|
||||
mulu.w #PIG_SPRITE_VERTICAL_BYTES,d0
|
||||
move.l #spriteFalling1,a0
|
||||
add.l d0,a0
|
||||
move.l a0,currentSprite
|
||||
add.w #1,spritePigFallingAnimation
|
||||
cmp.w #4<<1,spritePigFallingAnimation
|
||||
blt .dontResetAnimation
|
||||
move.w #0,spritePigFallingAnimation
|
||||
bsr HidePig
|
||||
.dontResetAnimation:
|
||||
rts
|
||||
|
||||
|
||||
UpdatePig:
|
||||
;; right
|
||||
cmp.w #PIG_PAUSE_PIXELS,spriteR
|
||||
ble .skipRight
|
||||
@@ -196,7 +218,33 @@ spritePigRightJump:
|
||||
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:
|
||||
dc.w 0
|
||||
currentSpriteOffset:
|
||||
dc.l 0
|
||||
currentSprite:
|
||||
|
||||
Reference in New Issue
Block a user