English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Contest

 
 
Thread Tools
Old 03 February 2019, 11:56   #661
jotd
This cat is no more
jotd's Avatar
 
Join Date: Dec 2004
Location: FRANCE
Age: 48
Posts: 3,541
Hey, don't blame small Rhino, he's new here.
jotd is offline  
Old 03 February 2019, 23:07   #662
mcgeezer
Registered User

 
Join Date: Oct 2017
Location: Sunderland, England
Posts: 1,639
If you like Game of Thrones you'll like this update.

http://109.228.4.199/herebedragons.mp4

[ Show youtube player ]

PS. Personally I can't stand the fucking pile of shit program but each to their own.

PPS. Although I don't mind the sexy time scenes in it

PPPS. Yes I know there are bugs... bugs bugs and more bugs... but I'll fix them at the right time... fox now we need a working game.
mcgeezer is online now  
Old 03 February 2019, 23:41   #663
roondar
Registered User

 
Join Date: Jul 2015
Location: The Netherlands
Posts: 1,624
Ooooh, there be DRAGONS here! Nice
roondar is offline  
Old 04 February 2019, 00:05   #664
Foul
Registered User

Foul's Avatar
 
Join Date: Jun 2009
Location: Perigueux/France
Age: 45
Posts: 1,436
Send a message via ICQ to Foul Send a message via MSN to Foul
and half dragons too
Foul is offline  
Old 04 February 2019, 01:38   #665
Jack Burton
It's all in the reflexes!
Jack Burton's Avatar
 
Join Date: Nov 2009
Location: Wingkong warehouses
Posts: 193
Quote:
Originally Posted by Foul View Post
and half dragons too

Only Amiga makes it possible
Jack Burton is offline  
Old 04 February 2019, 01:40   #666
Jack Burton
It's all in the reflexes!
Jack Burton's Avatar
 
Join Date: Nov 2009
Location: Wingkong warehouses
Posts: 193
Anyway, it looks each time better, congrats mcgeezer !
Jack Burton is offline  
Old 06 February 2019, 23:44   #667
mcgeezer
Registered User

 
Join Date: Oct 2017
Location: Sunderland, England
Posts: 1,639
After a night of frustration trying to resolve a bug when an enemy hits an obstacle and Rygar moves the obstacle off either left or right, I'm going to rewrite the core routine.

I'm not happy with the current routine and it's just become a pile of shit code as I've added things in the wrong order.

Specifically here's what I mean...

1) I coded the enemies spawning from left to right of where Rygar is
2) I then coded the grab/charge code for the Rhinos/Drones
3) I then coded the destroy/stun when Rygar jumps on an enemy
4) I then added the obstacle/platform collision routine of the enemy

The upshot... major bugs!

Here's how I should have done it.

1) coded the enemies spawning from left to right taking into account the obstacles/platforms and where Rygar is in the map
2) added the walking from left to right of the enemy in the map
3) coded the destroy/stun when Rygar jumps on an enemy
4) coded the grab/charge code

Pretty much everything backward!

For the coders ... here's how complex it is... (the worst code ever!)

Code:
ENEMY_RHINO_XPOS:		equ	500
ENEMY_RHINO_YPOS:		equ	114

RHINO_WALK_SPEED:		equ	14
;FRAMES_OFFSCREEN_BEFORE_DESTROYED:	equ	100		; Number of frames after which the sprite will disappear and be destroyed.

RHINO_STATUS_WALK_LEFT:		equ	1
RHINO_STATUS_WALK_RIGHT		equ	2
RHINO_STATUS_SWEEP_LEFT:	equ	3
RHINO_STATUS_SWEEP_RIGHT:	equ	4
RHINO_STATUS_BONES:		equ	5
RHINO_STATUS_STUN_LEFT:		equ	6
RHINO_STATUS_STUN_RIGHT:	equ	7
RHINO_STATUS_GRAB_LEFT:		equ	8
RHINO_STATUS_GRAB_RIGHT:	equ	9

RHINO_PROXIMITY_RANGE:		equ	64
RHINO_PROXIMITY_GRAB_SPEED:	equ	15
RHINO_GRAB_TIME:		equ	25


; Private Variables
RHINO_SPEED:			equ	32
RHINO_SWEEP_INDEX:		equ	34	; index in sine table
RHINO_TURNS:			equ	36	; Number of times the RHINO can turn to follow Rygar.
RHINO_GRABS:			equ	38	; True or False
						; This will configure the number of times the RHINO will attempt to run and grab Rygar.
						; if zero then the enemy is less dangerous.
RHINO_STUN_STATIC_TIMER:	equ	40
RHINO_WALK_DIRECTION:		equ	42	; Current walking direction.
RHINO_IN_PROXIMITY:		equ	44
RHINO_PROXIMITY_LEFT:		equ	46	; 
RHINO_PROXIMITY_RIGHT:		equ	48	; 


; Input
;d2=X Position of Enemy
;d3=Y position of Enemy
;a3 = Coordinates pointer x1,x2,y1,y2
; Output
;d6=Return value (-1 is collision)


RHINO_TO_DISKARM_COLLISION	MACRO
		move.l	d4,-(a7)
		move.l	d5,-(a7)
		move.w	d2,d4					; Check a 32x32 boundary from x1/y1
		move.w	d3,d5
		add.w	#22,d3					; 16x16 sprite.
		add.w	#32,d4
		add.w	#32,d5

		moveq	#0,d6
.eny_coll_loop:	tst.w	(a3)
		bmi.s	.eny_coll_exit
		cmp.w	2(a3),d2
		bgt.s	.eny_coll_next
		cmp.w	(a3),d4
		blt.s	.eny_coll_next
		cmp.w	6(a3),d3
		bgt.s	.eny_coll_next
		cmp.w	4(a3),d5
		blt.s	.eny_coll_next
		moveq	#-1,d6
		bra.s	.eny_coll_exit
.eny_coll_next:	addq.w	#8,a3
		bra.s	.eny_coll_loop
.eny_coll_exit:	move.l	(a7)+,d5
		move.l	(a7)+,d4
		ENDM


RHINO_TO_RYGAR_COLLISION	MACRO
		move.l	d4,-(a7)
		move.l	d5,-(a7)

		move.w	d2,d4					; Check a 32x32 boundary from x1/y1
		move.w	d3,d5
		add.w	#16,d3
		add.w	#32,d4
		add.w	#32,d5

		moveq	#0,d6
.ryg_coll_loop:	cmp.w	2(a3),d2				; Check X1 against Rygar X2
		bgt.s	.ryg_coll_next
		cmp.w	(a3),d4					; Check X2 against Rygar X1
		blt.s	.ryg_coll_next
		cmp.w	6(a3),d3				; Check Y1 against Rygar Y2
		bgt.s	.ryg_coll_next
		cmp.w	4(a3),d5				; Check Y2 against Rygar Y1
		blt.s	.ryg_coll_next
		moveq	#-1,d6
.ryg_coll_next:	nop
.ryg_coll_exit:	move.l	(a7)+,d5
		move.l	(a7)+,d4
		ENDM


HDL_RHINO:	
		SPRITE_INITIATE

		move.w	RHINO_TOGGLE,d2
		and.w	#1,d2
		bne.s	.spawn_right
.spawn_left:						; RHINO start x position
		move.w	#288,d2
		move.w	#RHINO_STATUS_WALK_LEFT,d3
		bra.s	.spawn

.spawn_right:	move.w	#10,d2
		move.w	#RHINO_STATUS_WALK_RIGHT,d3

.spawn:		move.w	d3,THIS_SPRITE_STATUS(a2)	; Set status
		move.w	d2,d4
		lsl.w	#SPRITE_MAG,d2
		move.w	d2,THIS_SPRITE_XPOS(a2)

		add.w	MAP_PIXEL_POSX,d4		; Set actual map x position of enemy sprite
		sub.w	#256,d4
		lsl.w	#SPRITE_MAG,d4
		move.w	d4,THIS_SPRITE_MAP_XPOS(a2)


		lsr.w	#SPRITE_MAG,d2
		move.w	d2,SPRITE_PLOT_XPOS(a1)
		move.w	#ENEMY_RHINO_YPOS,SPRITE_PLOT_YPOS(a1)
		clr.w	RHINO_SWEEP_INDEX(a2)

		move.w	#0,RHINO_TURNS(a2)
		move.w	#3,RHINO_GRABS(a2)
		move.w	#RHINO_WALK_SPEED,RHINO_SPEED(a2)
		clr.w	RHINO_IN_PROXIMITY(a2)
		move.w	#FRAMES_OFFSCREEN_BEFORE_DESTROYED,THIS_SPRITE_OFFSCREEN(a2)



.active:
		tst.w	SPRITE_DESTROY_END_ROUND(a2)
		bmi	.destroy_enemy


; These checks are only done when the enemy has been hit.
		cmp.w	#RHINO_STATUS_BONES,THIS_SPRITE_STATUS(a2)
		beq	.anim_bones
		cmp.w	#RHINO_STATUS_SWEEP_RIGHT,THIS_SPRITE_STATUS(a2)
		beq	.anim_sweep_rt
		cmp.w	#RHINO_STATUS_SWEEP_LEFT,THIS_SPRITE_STATUS(a2)
		beq	.anim_sweep_lt



; Test this enemy collided with the disk armour
		move.w	SPRITE_PLOT_XPOS(a1),d2
.check_proximity_range:
		move.w	RYGAR_XPOS,d3
		move.w	d3,d4
		sub.w	#RHINO_PROXIMITY_RANGE,d3
		add.w	#RHINO_PROXIMITY_RANGE,d4
		move.w	d3,RHINO_PROXIMITY_LEFT(a2)
		move.w	d4,RHINO_PROXIMITY_RIGHT(a2)
		
		cmp2.w	RHINO_PROXIMITY_LEFT(a2),d2
		bcs.s	.no_proximity
		tst.w	RHINO_IN_PROXIMITY(a2)				; Proximity already running
		bne.s	.no_proximity					; Yes... don't run again.
		tst.w	RHINO_GRABS(a2)					; Check how many grabs there are
		beq.s	.no_proximity					; zero so don't set grab 
		subq.w	#1,RHINO_GRABS(a2)
		move.w	#RHINO_GRAB_TIME,RHINO_IN_PROXIMITY(a2)

.no_proximity:
		move.w	SPRITE_PLOT_YPOS(a1),d3
		lea	DISKARM_COORDS,a3
		RHINO_TO_DISKARM_COLLISION
		tst.w	d6					; Did this sprite get hit with the disk armor
		bmi	.set_sweep_direction

		tst.w	RHINO_STUN_STATIC_TIMER(a2)
		bne.s	.go_left_or_right	

; Test this enemy collided with Rygar (the player)
		move.w	SPRITE_PLOT_XPOS(a1),d2
		move.w	SPRITE_PLOT_YPOS(a1),d3
		lea	RYGAR_COORDS,a3
		RHINO_TO_RYGAR_COLLISION

; Check if Rygar was falling here....

		tst.w	d6					; Did this sprite collide with Rygar?
		bmi	.check_collision_action

; These collision checks happen when the enemy is live.
.go_left_or_right:
		tst.w	THIS_SPRITE_STATUS(a2)
		beq	.exit

		lea	SPRITE_SCREEN_LIMITS_X,a3
		move.w	SPRITE_PLOT_XPOS(a1),d2
		cmp2.w	(a3),d2					; if within limit then do not subtract.
		bcc.s	.in_limit
		subq.w	#1,THIS_SPRITE_OFFSCREEN(a2)
		tst.w	THIS_SPRITE_OFFSCREEN(a2)
		bmi	.disable
		bra.s	.out_limit

.in_limit:	move.w	#FRAMES_OFFSCREEN_BEFORE_DESTROYED,THIS_SPRITE_OFFSCREEN(a2)
.out_limit:
		move.w	THIS_SPRITE_OFFSCREEN(a2),DEBUG_OFFSCREEN

		cmp.w	#RHINO_STATUS_WALK_LEFT,THIS_SPRITE_STATUS(a2)
		beq	.RHINO_left
		cmp.w	#RHINO_STATUS_WALK_RIGHT,THIS_SPRITE_STATUS(a2)
		beq	.RHINO_right
		bra	.exit

.check_collision_action:
		tst.w	RYGAR_FALLPREV_STATE
		bmi.s	.stun_or_destroy

		IFNE	DISABLE_ENEMY_COLLISION
		bra	.go_left_or_right
		ELSE


		bra.s	.set_rygar_death_sequence
		ENDC

		nop

.stun_or_destroy:
		tst.w	RHINO_STUN_STATIC_TIMER(a2)
		bne	.go_left_or_right

		;move.w	#-1,RYGAR_ROLLFALL_STATE
		clr.w	RYGAR_FALL_STATE			; Stop Falling
		move.w	#-1,RYGAR_JUMP_STATE			; Start Jumping	
		clr.w	RYGAR_SINE_INDEX		; Reset Jump Sine pointer.
		;move.w	#-1,RYGAR_LEAPING_STATE		; Don't leap


		moveq	#0,d2
		lea	HDL_SPRITE_STATUS,a0	
		lea	TAB_64,a3		
		add.w	(a3,d2*2),a0
		move.w	#SPRITE_INSTATE_JUMPING,THIS_SPRITE_STATUS(a0)	; Set to jumping.
; Check here if Rygar has Tiger power.

		move.w	RYGAR_CURRENT_POWERS,d2
		and.w	#POWER_TIGER,d2
		bne	.destroy_enemy				; If Rygar has Tiger then enemy is destroy
		bra.s	.set_stun				; If not then the enemy is stunned.
		nop

.set_stun:	move.w	#TIGER_STUN_STATIC_TIME,RHINO_STUN_STATIC_TIMER(a2)
		moveq	#SND_LAND_ON_ENEMY,d0		; Play jump sample
		bsr	PLAY_SAMPLE
		bra	.exit

.set_rygar_death_sequence:
		rept	20
		nop
		endr

		tst.w	RYGAR_DEAD_STATE
		bmi 	.exit				; Rygar already dead!
		move.w	#-1,RYGAR_DEAD_STATE
		clr.w	RYGAR_SINE_INDEX
		moveq	#0,d2
		lea	HDL_SPRITE_STATUS,a0	
		lea	TAB_64,a3		
		add.w	(a3,d2*2),a0
		move.w	#RYGAR_DEATH,THIS_SPRITE_STATUS(a0)	

		bsr	STOP_TUNE

		moveq	#SND_RYGARDEAD,d0		; Play jump sample
		bsr	PLAY_SAMPLE

		bra	.exit

.stun_enemy:	bra	.exit

.destroy_enemy:
		clr.w	SPRITE_DESTROY_END_ROUND(a2)
.set_sweep_direction:
		move.w	#-1,DISKARM_DISABLE				; Only with no Sun power.

		moveq	#SND_DESTROY,d0
		bsr	PLAY_SAMPLE

		cmp.w	#RHINO_STATUS_WALK_LEFT,THIS_SPRITE_STATUS(a2)
		beq	.set_sweep_rt
		
		bra.s	.set_sweep_lt

	nop

; Trigger enemy death toward the left
.set_sweep_lt:	move.w	#RHINO_STATUS_SWEEP_LEFT,THIS_SPRITE_STATUS(a2)
		addq.w	#1,REPULSE_BONUS_NUM
		add.l	#200,VAL_PLAYER1_SCORE
		move.w	#-1,UPDATE_SCORE
		bra	.exit


; Trigger enemy death toward the right
.set_sweep_rt:	move.w	#RHINO_STATUS_SWEEP_RIGHT,THIS_SPRITE_STATUS(a2)
		addq.w	#1,REPULSE_BONUS_NUM
		add.l	#200,VAL_PLAYER1_SCORE
		move.w	#-1,UPDATE_SCORE
		bra	.exit


.anim_sweep_lt:	moveq	#RHINO_STATUS_SWEEP_LEFT,d1
		cmp.w	#32,SPRITE_PLOT_XPOS(a1)
		ble	.set_bones
		lea	RHINO_DEATH_SINE,a3
		move.w	RHINO_SWEEP_INDEX(a2),d3
		move.w	(a3,d3*2),d3
		tst.w	d3
		bmi	.set_bones
		addq.w	#1,RHINO_SWEEP_INDEX(a2)
		move.w	THIS_SPRITE_XPOS(a2),d2
		lsl.w	#SPRITE_MAG,d3
		sub.w	d3,d2
		move.w	d2,THIS_SPRITE_XPOS(a2)
		lsr.w	#SPRITE_MAG,d2
		move.w	d2,SPRITE_PLOT_XPOS(a1)
		bra	ANIMATE

.anim_sweep_rt:	
		moveq	#RHINO_STATUS_SWEEP_RIGHT,d1
		cmp.w	#248,SPRITE_PLOT_XPOS(a1)
		bge	.set_bones
		lea	RHINO_DEATH_SINE,a3
		move.w	RHINO_SWEEP_INDEX(a2),d3
		move.w	(a3,d3*2),d3
		tst.w	d3
		bmi.s	.set_bones
		addq.w	#1,RHINO_SWEEP_INDEX(a2)
		move.w	THIS_SPRITE_XPOS(a2),d2
		lsl.w	#SPRITE_MAG,d3
		add.w	d3,d2
		move.w	d2,THIS_SPRITE_XPOS(a2)
		lsr.w	#SPRITE_MAG,d2
		move.w	d2,SPRITE_PLOT_XPOS(a1)
		bra	ANIMATE
	
.anim_bones:	moveq	#RHINO_STATUS_BONES,d1
		move.l	d0,-(a7)
		bsr	ANIMATE
		move.l	(a7)+,d0
		tst.w	d6
		bmi.s	.disable
		bra	.exit

.disable:	clr.w	THIS_SPRITE_STATUS(a2)
		clr.w	THIS_SPRITE_STATUS(a1)
		subq.w	#1,RHINOS_IN_USE
		bra	DESTROY_SPRITE



; Trigger enemy sprite bones
.set_bones:	move.w	#RHINO_STATUS_BONES,THIS_SPRITE_STATUS(a2)
		bra	.exit

; RHINO walking left
.RHINO_left:	move.w	THIS_SPRITE_XPOS(a2),d2		; Get xposition
		move.w	RHINO_SPEED(a2),d3		; Get speed to add
		add.w	d0,d3
		add.w	d0,d3
		moveq	#RHINO_STATUS_WALK_LEFT,d1	; Animation type is walking left
		

; Is Rygar to the left?
		move.w	SPRITE_PLOT_XPOS(a1),d4		; Plot X position
		tst.w	RHINO_IN_PROXIMITY(a2)		; Is the RHINO in proximity of Rygar
		beq.s	.lt_noprox			; Not in proximity
		subq.w	#1,RHINO_IN_PROXIMITY(a2)
		cmp.w	RYGAR_XPOS,d4			; is Rygar to the Left
		blt.s	.lt_noprox			; No... don't grab then.

		moveq	#RHINO_STATUS_GRAB_LEFT,d1
		;add.w	d3,d3				; Double speed if grabbing!
.lt_noprox:
		tst.w	RHINO_STUN_STATIC_TIMER(a2)
		beq.s	.lt_no_stun
		moveq	#RHINO_STATUS_STUN_LEFT,d1
		moveq	#0,d3
		subq.w	#1,RHINO_STUN_STATIC_TIMER(a2)
		cmp.w	#TIGER_STUN_REVIVE_TIME,RHINO_STUN_STATIC_TIMER(a2)
		bgt.s	.lt_no_shake
		lea	RHINO_SHAKE_OFFSETS,a3
		move.w	RHINO_STUN_STATIC_TIMER(a2),d4
		move.w	(a3,d4*2),d3
.lt_no_shake:
.lt_no_stun:	sub.w	d3,THIS_SPRITE_MAP_XPOS(a2)
		tst.w	THIS_SPRITE_MAP_XPOS(a2)				; if hit 0 going left then go right.
		beq	.lt_set_right
		bmi	.lt_set_right

		;add.w	#16<<SPRITE_MAG,THIS_SPRITE_ACTUAL_XPOS(a2)
		tst.b	SCROLL_EDGE_LOCK_X
		bpl.s	.lt_still
		tst.w	SCROLL_DIRECTION_X	; -1 if left, +1 if right
		bmi.s	.lt_left
		beq.s	.lt_still
.lt_right:	add.w	#RYGAR_MOVE_SPEED<<SPRITE_MAG,d3			; added (faster) when moving toward
		bra.s	.lt_still
.lt_left	sub.w	#RYGAR_MOVE_SPEED<<SPRITE_MAG,d3			; subtracted (slower) when moving away
		bra.s	.lt_still
		nop
.lt_still:			
		sub.w	d3,d2

		lea	ROUND_ENEMY_POSITIONS,a3	
		moveq	#0,d4
		move.w	THIS_SPRITE_MAP_XPOS(a2),d4
		lsr.w	#SPRITE_MAG,d4
		lsr.w	#4,d4
		move.w	d4,RHINO_BLOCK
		move.l	(a3,d4*4),d4
		and.l	#ENEMY_DEF_RHINO,d4
		bne.s	.lt_cont
.lt_set_right:
		move.w	#RHINO_STATUS_WALK_RIGHT,THIS_SPRITE_STATUS(a2)
		add.w	d3,THIS_SPRITE_MAP_XPOS(a2)
		add.w	d3,THIS_SPRITE_XPOS(a2)
		bra	ANIMATE
		
.lt_cont:	move.w	d2,THIS_SPRITE_XPOS(a2)				; ffff
		lsr.w	#SPRITE_MAG,d2					; 0fff
		;move.w	d2,DEBUG_RHINO_XPOS
		move.w	d2,SPRITE_PLOT_XPOS(a1)

		move.w	d1,RHINO_WALK_DIRECTION(a2)
		bra	ANIMATE	



; RHINO walking Right from the Left (THIS IS OK)
.RHINO_right:	move.w	THIS_SPRITE_XPOS(a2),d2
		move.w	RHINO_SPEED(a2),d3
		add.w	d0,d3
		add.w	d0,d3
		moveq	#RHINO_STATUS_WALK_RIGHT,d1

; Is Rygar to the left?
		move.w	SPRITE_PLOT_XPOS(a1),d4
		tst.w	RHINO_IN_PROXIMITY(a2)
		beq.s	.rg_noprox
		subq.w	#1,RHINO_IN_PROXIMITY(a2)
		cmp.w	RYGAR_XPOS,d4			; is Rygar to the Left
		bgt.s	.rg_noprox			; No... don't grab then.
		;COL0_BLUE

		moveq	#RHINO_STATUS_GRAB_RIGHT,d1
		;add.w	d3,d3
.rg_noprox:
		tst.w	RHINO_STUN_STATIC_TIMER(a2)
		beq.s	.rg_no_stun
		moveq	#RHINO_STATUS_STUN_RIGHT,d1
		moveq	#0,d3
		subq.w	#1,RHINO_STUN_STATIC_TIMER(a2)
		cmp.w	#TIGER_STUN_REVIVE_TIME,RHINO_STUN_STATIC_TIMER(a2)
		bgt.s	.rg_no_shake
		lea	RHINO_SHAKE_OFFSETS,a3
		move.w	RHINO_STUN_STATIC_TIMER(a2),d4
		move.w	(a3,d4*2),d3
.rg_no_shake:

.rg_no_stun:	add.w	d3,THIS_SPRITE_MAP_XPOS(a2)
		;add.w	#16<<SPRITE_MAG,THIS_SPRITE_ACTUAL_XPOS(a2)
		tst.b	SCROLL_EDGE_LOCK_X
		bpl.s	.rg_still
		tst.w	SCROLL_DIRECTION_X	; -1 if left, +1 if right
		bmi.s	.rg_left
		beq.s	.rg_still
		nop
.rg_right:	sub.w	#RYGAR_MOVE_SPEED<<SPRITE_MAG,d3			; added (faster) when moving toward
		bra.s	.rg_still
.rg_left	add.w	#RYGAR_MOVE_SPEED<<SPRITE_MAG,d3			; subtracted (slower) when moving away
		bra.s	.rg_still
		nop
.rg_still:	add.w	d3,d2

		lea	ROUND_ENEMY_POSITIONS,a3	
		moveq	#0,d4
		move.w	THIS_SPRITE_MAP_XPOS(a2),d4
		lsr.w	#SPRITE_MAG,d4
		lsr.w	#4,d4
		move.w	d4,RHINO_BLOCK
		move.l	(a3,d4*4),d4
		and.l	#ENEMY_DEF_RHINO,d4
		bne.s	.rt_cont
		move.w	#RHINO_STATUS_WALK_LEFT,THIS_SPRITE_STATUS(a2)
		sub.w	d3,THIS_SPRITE_MAP_XPOS(a2)
		sub.w	d3,THIS_SPRITE_XPOS(a2)
		bra	ANIMATE
.rt_cont:
		move.w	d2,THIS_SPRITE_XPOS(a2)
		lsr.w	#SPRITE_MAG,d2
		move.w	d2,SPRITE_PLOT_XPOS(a1)
		move.w	d1,RHINO_WALK_DIRECTION(a2)
		bra	ANIMATE
.exit:		rts
I'm pissed off!

Geezer
mcgeezer is online now  
Old 07 February 2019, 00:35   #668
Nightshft
Registered User

Nightshft's Avatar
 
Join Date: Mar 2018
Location: Austria
Age: 44
Posts: 301
Either way, a lot of respect for your work Geezer!
I hope you find the best and most efficient way to improve/rewrite the code.

Stupid question: Would it make sense to abstract the code for another level (f.e. a higher level of main loop / subroutines). Sorry if this is silly, i have no idea about your code, it's just a thought.
Nightshft is online now  
Old 07 February 2019, 00:37   #669
roondar
Registered User

 
Join Date: Jul 2015
Location: The Netherlands
Posts: 1,624
Rewriting code is one of those things... Never fun, but I have found the end result usually makes me happier than leaving it as is.

It's just the whole "why didn't I think this through/why didn't I think of this" that makes it blergh. IMHO anyway
roondar is offline  
Old 07 February 2019, 00:49   #670
mcgeezer
Registered User

 
Join Date: Oct 2017
Location: Sunderland, England
Posts: 1,639
Quote:
Originally Posted by roondar View Post
Rewriting code is one of those things... Never fun, but I have found the end result usually makes me happier than leaving it as is.

It's just the whole "why didn't I think this through/why didn't I think of this" that makes it blergh. IMHO anyway
Definitely this ^^^

A bit of pre- thought would have gone a long way.
Next version will be much better, simpler and straight forward.

Geezer
mcgeezer is online now  
Old 07 February 2019, 04:32   #671
buzzybee
Registered User

 
Join Date: Oct 2015
Location: Landsberg / Germany
Posts: 311
Can totally relate to that. Writing code and then throwing it all away and replace it with a more elegant / practical solution – I think that´s part of the development process. Happens everyone all the time and feels frustrating a lot of times, but very fulfilling when all pieces fall together

So keep on rockin. Btw. I just had a quick look at your code, not too intense. Maybe you could think about using the 68020s cmp2-instruction within the collission box logic. I think it makes code smaller and better readable, and as your game does not need to run on a 68000 ... well ...
buzzybee is offline  
Old 08 February 2019, 16:35   #672
JuanLuis
Registered User
 
Join Date: Dec 2018
Location: Málaga
Posts: 45
Mc Geezer, thanks for sharing the evolution of your development. I have curiosity about a detail on stage 4. There is a static big sun on background and a dual parallax of mountains and the trees on foreground. Is there any trick? How it's made?

I believed that you were able to draw two planes with parallax and a static color background (or colorful with copper effects). I know there are some games like Risky Woods and Jim Power that use hardware sprites to add a new parallax plane, but I see many enemies and the main character. If these characters are hw. sprites then it's not posible to implement a background made of sprites. However I can see the sun behind the mountains. I have curiosity about it.

Thanks again Mc Geezer.
JuanLuis is offline  
Old 08 February 2019, 22:20   #673
mcgeezer
Registered User

 
Join Date: Oct 2017
Location: Sunderland, England
Posts: 1,639
Quote:
Originally Posted by JuanLuis View Post
Mc Geezer, thanks for sharing the evolution of your development. I have curiosity about a detail on stage 4. There is a static big sun on background and a dual parallax of mountains and the trees on foreground. Is there any trick? How it's made?

I believed that you were able to draw two planes with parallax and a static color background (or colorful with copper effects). I know there are some games like Risky Woods and Jim Power that use hardware sprites to add a new parallax plane, but I see many enemies and the main character. If these characters are hw. sprites then it's not posible to implement a background made of sprites. However I can see the sun behind the mountains. I have curiosity about it.

Thanks again Mc Geezer.
Yes I simply blit three planes... 2 planes for the sun and 1 for the mountains, the colour palette is such that the first four colours are for the Sun and then the last 4 are all Black, when the 3rd plane is drawn it then provides the parallax - very straight forward.


In other news I've re-written then way sprites are managed... You'll recall I wrote some really shit code that was just un-manageable.

Well.... here is the new streamlined, working, easier to manage, portable version...

Code:
ENEMY_RHINO_XPOS:		equ	500
ENEMY_RHINO_YPOS:		equ	114

RHINO_WALK_SPEED:		equ	14
;FRAMES_OFFSCREEN_BEFORE_DESTROYED:	equ	100		; Number of frames after which the sprite will disappear and be destroyed.

RHINO_STATUS_BONES:		equ	1
RHINO_STATUS_SWEEP_LEFT:	equ	2
RHINO_STATUS_SWEEP_RIGHT:	equ	3

RHINO_STATUS_STUN_LEFT:		equ	4
RHINO_STATUS_STUN_RIGHT:	equ	5

RHINO_STATUS_WALK_LEFT:		equ	6
RHINO_STATUS_WALK_RIGHT		equ	7

RHINO_STATUS_GRAB_LEFT:		equ	8
RHINO_STATUS_GRAB_RIGHT:	equ	9
RHINO_STATUS_TURN_DELAY:	equ	10
RHINO_STATUS_DESTROYED:		equ	11

RHINO_GRABS:			equ	1
RHINO_PROXIMITY_RANGE:		equ	48
RHINO_PROXIMITY_GRAB_SPEED:	equ	10
RHINO_GRAB_TIME:		equ	40
RHINO_TURN_DELAY_TIME:		equ	10
RHINO_GRAB_DELAY_TIME:		equ	30
RHINO_GO_LEFT:			equ	-1
RHINO_GO_RIGHT:			equ	0	


; Private Variables
PRIVATE_RHINO_SPEED:		equ	32
PRIVATE_RHINO_SWEEP_INDEX:	equ	34	; index in sine table
PRIVATE_RHINO_TURNS:		equ	36	; Number of times the RHINO can turn to follow Rygar.
PRIVATE_RHINO_GRABS:		equ	38	; True or False
						; This will configure the number of times the RHINO will attempt to run and grab Rygar.
						; if zero then the enemy is less dangerous.
PRIVATE_RHINO_TIMER:		equ	40
PRIVATE_RHINO_DIRECTION:	equ	42	; Current walking direction (-1 Left, 0=Right)
PRIVATE_RHINO_UNUSED_1:		equ	44
PRIVATE_RHINO_PROXIMITY_LEFT:	equ	46	; 
PRIVATE_RHINO_PROXIMITY_RIGHT:	equ	48	; 
PRIVATE_RHINO_STUN_TIMER:	equ	50



; Input
;d2=X Position of Enemy
;d3=Y position of Enemy
;a3 = Coordinates pointer x1,x2,y1,y2
; Output
;d6=Return value (-1 is collision)


RHINO_TO_DISKARM_COLLISION	MACRO
		move.l	d4,-(a7)
		move.l	d5,-(a7)
		move.w	d2,d4					; Check a 32x32 boundary from x1/y1
		move.w	d3,d5
		add.w	#22,d3					; 16x16 sprite.
		add.w	#32,d4
		add.w	#32,d5

		moveq	#0,d6
.eny_coll_loop:	tst.w	(a3)
		bmi.s	.eny_coll_exit
		cmp.w	2(a3),d2
		bgt.s	.eny_coll_next
		cmp.w	(a3),d4
		blt.s	.eny_coll_next
		cmp.w	6(a3),d3
		bgt.s	.eny_coll_next
		cmp.w	4(a3),d5
		blt.s	.eny_coll_next
		moveq	#-1,d6
		bra.s	.eny_coll_exit
.eny_coll_next:	addq.w	#8,a3
		bra.s	.eny_coll_loop
.eny_coll_exit:	move.l	(a7)+,d5
		move.l	(a7)+,d4
		ENDM


RHINO_TO_RYGAR_COLLISION	MACRO
		move.l	d4,-(a7)
		move.l	d5,-(a7)

		move.w	d2,d4					; Check a 32x32 boundary from x1/y1
		move.w	d3,d5
		add.w	#16,d3
		add.w	#32,d4
		add.w	#32,d5

		moveq	#0,d6
.ryg_coll_loop:	cmp.w	2(a3),d2				; Check X1 against Rygar X2
		bgt.s	.ryg_coll_next
		cmp.w	(a3),d4					; Check X2 against Rygar X1
		blt.s	.ryg_coll_next
		cmp.w	6(a3),d3				; Check Y1 against Rygar Y2
		bgt.s	.ryg_coll_next
		cmp.w	4(a3),d5				; Check Y2 against Rygar Y1
		blt.s	.ryg_coll_next
		moveq	#-1,d6
.ryg_coll_next:	nop
.ryg_coll_exit:	move.l	(a7)+,d5
		move.l	(a7)+,d4
		ENDM

; Return the current camera position at the left most handle.
; d6=left position, d7=right position
FIND_CAMERA_XPOS	MACRO
		moveq	#0,d6
		moveq	#0,d7
		move.w	MAP_PIXEL_POSX,d6		; Pixel Position of current camera
		sub.w	#256,d6
		move.w	d6,d7				; Get left most position
		add.w	#(PLAYFIELD_SIZE_X*8),d7	; Get Right most position	
		lsl.w	#4,d6				; Interpolate to 16*16... 4 for speed interpolate
		lsl.w	#4,d7				;
		ENDM

; Check the current x position in d6 if it is blocked
; In:  d6=xposition interpolated
;      d7=ENEMY MASK (i.e ENEMY_DEF_RHINO
; Out: d6=0 (Blocked), d6=+ Unblocked
 
IS_PATH_BLOCKED	MACRO
		lea	ROUND_ENEMY_POSITIONS,a0
		lsr.w	#8,d6				; Interpolate down
		move.l	(a0,d6*4),d6
		and.l	d7,d6
		ENDM

UPDATE_SPRITE_PLOT_XPOS	MACRO
		move.w	d2,THIS_SPRITE_MAP_XPOS(a2)
		move.w	d2,DEBUG_THIS_SPRITE_MAP_XPOS
		move.w	MAP_PIXEL_POSX,d3
		sub.w	#$100,d3
		lsr.w	#4,d2
		sub.w	d3,d2
		move.w	d2,SPRITE_PLOT_XPOS(a1)
		move.w	d2,DEBUG_SPRITE_PLOT_XPOS
		ENDM

GET_PLAYER_SPRITE_CONTEXT MACRO
		moveq	#SPR_TYPE_PLAYER,d2					
		lea	HDL_SPRITE_STATUS,a0	
		lea	TAB_64,a3		
		add.w	(a3,d2*2),a0
		ENDM

; Sets the private variable DRONE_IN_PROXIMITY to -1 if true, otherwise 0.
; If enemy is approaching Rygar then check proximity.
; -- If enemy is moving left, and Rygar is to the left then check.
; -- if enemy is moving right, and Rygar is to the right then check.
RHINO_CHECK_AND_SET_PROXIMITY MACRO
		tst.w	PRIVATE_RHINO_GRABS(a2)				; Number of grabs done?
		beq	.proximity_out_of_range

		tst.w	PRIVATE_RHINO_TIMER(a2)
		bpl.s	.proximity_out_of_range
	
		tst.w	RYGAR_FALL_STATE
		bne	.proximity_out_of_range
		tst.w	RYGAR_JUMP_STATE
		bne	.proximity_out_of_range

		move.w	SPRITE_PLOT_XPOS(a1),d2
		move.w	RYGAR_XPOS,d3

; If enemy is moving left then check right

		tst.w	PRIVATE_RHINO_DIRECTION(a2)			; If moving left then check right
		bmi.s	.proximity_right				; If moving right then check left
.proximity_left:
		sub.w	#RHINO_PROXIMITY_RANGE,d3
		move.w	d3,d4
		subq.w	#2,d3
		bra.s	.proximity_check
	
.proximity_right:
		move.w	#$007,FIRECOLOUR
		add.w	#RHINO_PROXIMITY_RANGE,d3
		move.w	d3,d4
		addq.w	#2,d4

.proximity_check:
		move.w	d3,PRIVATE_RHINO_PROXIMITY_LEFT(a2)
		move.w	d4,PRIVATE_RHINO_PROXIMITY_RIGHT(a2)
		
		cmp2.w	PRIVATE_RHINO_PROXIMITY_LEFT(a2),d2
		bcs.s	.proximity_out_of_range				; 
		cmp.w	#RHINO_STATUS_WALK_LEFT,THIS_SPRITE_STATUS(a2)
		beq	.method_set_grab_left
		cmp.w	#RHINO_STATUS_WALK_RIGHT,THIS_SPRITE_STATUS(a2)
		beq	.method_set_grab_right

		bsr	FIREWAIT
.proximity_out_of_range:	
		ENDM


RHINO_SHAKE	MACRO
		cmp.w	#TIGER_STUN_REVIVE_TIME,PRIVATE_RHINO_STUN_TIMER(a2)	; if Stun revive time is greater 
		bgt	ANIMATE							; then remaining time, then do nothing.
		lea	RHINO_SHAKE_OFFSETS,a3
		move.w	PRIVATE_RHINO_STUN_TIMER(a2),d4
		move.w	(a3,d4*2),d4
		add.w	d4,SPRITE_PLOT_XPOS(a1)
		ENDM



HDL_RHINO:	
		SPRITE_INITIATE

; Set the initial variables and status of the sprite.
.construct:	
		FIND_CAMERA_XPOS

		tst.w	RHINO_TOGGLE					;0 = left, -1 = right
		bne.s	.create_right
.create_left:	exg	d6,d7						; set space position
		move.w	#RHINO_STATUS_WALK_RIGHT,THIS_SPRITE_STATUS(a2)	; Create to the right, walk left
		move.w	#RHINO_GO_RIGHT,PRIVATE_RHINO_DIRECTION(a2)
		bra.s	.create
.create_right:	move.w	#RHINO_STATUS_WALK_LEFT,THIS_SPRITE_STATUS(a2)	; Create to the left, walk right
		move.w	#RHINO_GO_LEFT,PRIVATE_RHINO_DIRECTION(a2)
.create:
; d7 = spawn x position
		move.w	d7,THIS_SPRITE_MAP_XPOS(a2)			; Set start position in the map.
		move.w	#RHINO_WALK_SPEED,PRIVATE_RHINO_SPEED(a2)
		move.w	#-1,PRIVATE_RHINO_TIMER(a2)
		move.w	#-1,PRIVATE_RHINO_STUN_TIMER(a2)
		move.w	#RHINO_GRABS,PRIVATE_RHINO_GRABS(a2)

.active:	move.w	PRIVATE_RHINO_STUN_TIMER(a2),DEBUG_RHINO_STUN_TIMER
		move.w	PRIVATE_RHINO_GRABS(a2),DEBUG_RHINO_GRABS
		bra.s	.sprite_0

.animate_table:	dc.l	0		; 0
		dc.l	.method_animate_bones-.animate_table		; 1
		dc.l	.method_animate_sweep_left-.animate_table	; 2
		dc.l	.method_animate_sweep_right-.animate_table	; 3
		dc.l	.method_animate_stun_left-.animate_table	; 4
		dc.l	.method_animate_stun_right-.animate_table	; 5
		dc.l	.method_animate_walk_left-.animate_table	; 6
		dc.l	.method_animate_walk_right-.animate_table	; 7
		dc.l	.method_animate_grab_left-.animate_table	; 8
		dc.l	.method_animate_grab_right-.animate_table	; 9
		dc.l	.method_animate_turn_delay-.animate_table	; 10
		dc.l	.method_destroy_sprite-.animate_table		; 11

.sprite_0:	tst.w	SPRITE_DESTROY_END_ROUND(a2)
		beq.s	.sprite_1
		move.w	#RHINO_STATUS_DESTROYED,THIS_SPRITE_STATUS(a2)

.sprite_1:	cmp.w	#RHINO_STATUS_SWEEP_RIGHT,THIS_SPRITE_STATUS(a2)		; if doing bones or sweeps then skip all collisions
		ble	.run_sprite_method

		cmp.w	#RHINO_STATUS_STUN_RIGHT,THIS_SPRITE_STATUS(a2)			; if doing stuns then skip Rygar collision
		ble	.sprite_stunned

; Set the proximity flag
		RHINO_CHECK_AND_SET_PROXIMITY


; Test this enemy collided with Rygar (the player)
.sprite_2:	move.w	SPRITE_PLOT_XPOS(a1),d2
		move.w	SPRITE_PLOT_YPOS(a1),d3
		lea	RYGAR_COORDS,a3
		RHINO_TO_RYGAR_COLLISION
		tst.w	d6					; Did this sprite collide with Rygar?
		bmi	.method_set_collision_action		; Yes

; Check if the enemy has been hit with disk armor
.sprite_stunned:
		move.w	SPRITE_PLOT_XPOS(a1),d2		
		move.w	SPRITE_PLOT_YPOS(a1),d3
		lea	DISKARM_COORDS,a3
		RHINO_TO_DISKARM_COLLISION
		tst.w	d6					; Did this sprite get hit with the disk armor
		bmi	.method_set_sweep_direction		; Yes
		
; Test this enemy collided with the disk armour
.run_sprite_method:
		lea	.animate_table(pc),a0			; Call the method based on value of THIS_SPRITE_STATUS(a2)
		move.w	THIS_SPRITE_STATUS(a2),d2
		add.l	(a0,d2*4),a0
		jmp	(a0)



; d2=xpos to plot sprite
; 
.method_animate_walk_left:
		move.w	THIS_SPRITE_MAP_XPOS(a2),d6
		sub.w	PRIVATE_RHINO_SPEED(a2),d6
		bmi	.method_set_turn_delay
		move.l	#ENEMY_DEF_RHINO,d7
		move.w	d6,d2
		IS_PATH_BLOCKED
		beq	.method_set_turn_delay
		UPDATE_SPRITE_PLOT_XPOS
		moveq	#RHINO_STATUS_WALK_LEFT,d1
		bra	ANIMATE

.method_animate_walk_right:
		move.w	THIS_SPRITE_MAP_XPOS(a2),d6
		add.w	PRIVATE_RHINO_SPEED(a2),d6
		move.l	#ENEMY_DEF_RHINO,d7
		move.w	d6,d2
		IS_PATH_BLOCKED
		beq	.method_set_turn_delay
		UPDATE_SPRITE_PLOT_XPOS
		moveq	#RHINO_STATUS_WALK_RIGHT,d1
		bra	ANIMATE

.method_animate_sweep_left:
		cmp.w	#32,SPRITE_PLOT_XPOS(a1)
		ble	.method_set_bones
		lea	RHINO_DEATH_SINE,a3
		move.w	PRIVATE_RHINO_SWEEP_INDEX(a2),d3
		move.w	(a3,d3*2),d3
		tst.w	d3
		bmi	.method_set_bones
		addq.w	#1,PRIVATE_RHINO_SWEEP_INDEX(a2)
		sub.w	d3,SPRITE_PLOT_XPOS(a1)

		moveq	#RHINO_STATUS_SWEEP_LEFT,d1
		bra	ANIMATE

.method_animate_sweep_right:
		cmp.w	#248,SPRITE_PLOT_XPOS(a1)
		bge	.method_set_bones
		lea	RHINO_DEATH_SINE,a3
		move.w	PRIVATE_RHINO_SWEEP_INDEX(a2),d3
		move.w	(a3,d3*2),d3
		tst.w	d3
		bmi	.method_set_bones
		addq.w	#1,PRIVATE_RHINO_SWEEP_INDEX(a2)
		add.w	d3,SPRITE_PLOT_XPOS(a1)
		moveq	#RHINO_STATUS_SWEEP_RIGHT,d1
		bra	ANIMATE

.method_animate_bones:
		moveq	#RHINO_STATUS_BONES,d1
		movem.l	d0-1/a1-a2,-(a7)
		bsr	ANIMATE
		movem.l	(a7)+,d0-1/a1-a2
		tst.w	d6
		bmi	.method_set_destroy_sprite
		bra	.exit

.method_animate_stun_left:
		moveq	#RHINO_STATUS_STUN_LEFT,d1
		move.w	THIS_SPRITE_MAP_XPOS(a2),d2
		UPDATE_SPRITE_PLOT_XPOS
		subq.w	#1,PRIVATE_RHINO_STUN_TIMER(a2)
		bmi	.method_set_walk_left
		RHINO_SHAKE
		bra	ANIMATE

.method_animate_stun_right:
		moveq	#RHINO_STATUS_STUN_RIGHT,d1
		move.w	THIS_SPRITE_MAP_XPOS(a2),d2
		UPDATE_SPRITE_PLOT_XPOS
		subq.w	#1,PRIVATE_RHINO_STUN_TIMER(a2)
		bmi	.method_set_walk_right
		RHINO_SHAKE
		bra	ANIMATE


.method_animate_grab_left:
		tst.w	PRIVATE_RHINO_TIMER(a2)				; Finished grabbing to the left?
		bmi	.method_reverse_direction
		subq.w	#1,PRIVATE_RHINO_TIMER(a2)

		move.w	THIS_SPRITE_MAP_XPOS(a2),d6
		sub.w	PRIVATE_RHINO_SPEED(a2),d6
		sub.w	#RHINO_PROXIMITY_GRAB_SPEED,d6
		bmi	.method_set_walk_right
		move.l	#ENEMY_DEF_RHINO,d7
		move.w	d6,d2
		IS_PATH_BLOCKED
		beq	.method_set_walk_right
		UPDATE_SPRITE_PLOT_XPOS
		moveq	#RHINO_STATUS_GRAB_LEFT,d1
		bra	ANIMATE

.method_animate_grab_right:
		tst.w	PRIVATE_RHINO_TIMER(a2)				; Finished grabbing to the right?
		bmi	.method_reverse_direction
		subq.w	#1,PRIVATE_RHINO_TIMER(a2)

		move.w	THIS_SPRITE_MAP_XPOS(a2),d6
		add.w	PRIVATE_RHINO_SPEED(a2),d6
		add.w	#RHINO_PROXIMITY_GRAB_SPEED,d6
		move.l	#ENEMY_DEF_RHINO,d7
		move.w	d6,d2
		IS_PATH_BLOCKED
		beq	.method_set_walk_left
		UPDATE_SPRITE_PLOT_XPOS
		moveq	#RHINO_STATUS_GRAB_RIGHT,d1
		bra	ANIMATE

.method_animate_turn_delay:
		tst.w	PRIVATE_RHINO_TIMER(a2)
		bmi	.method_reverse_direction
		subq.w	#1,PRIVATE_RHINO_TIMER(a2)
		bra	.exit

.method_reverse_direction:
		tst.w	PRIVATE_RHINO_DIRECTION(a2)
		beq.s	.method_set_walk_left
		bra.s	.method_set_walk_right

.method_destroy_sprite:
		subq.w	#1,RHINOS_IN_USE
		clr.w	THIS_SPRITE_STATUS(a2)
		bra	DESTROY_SPRITE

.method_set_destroy_sprite:
		move.w	#RHINO_STATUS_DESTROYED,THIS_SPRITE_STATUS(a2)
		bra	.exit

.method_set_walk_left:
		move.w	#RHINO_GO_LEFT,PRIVATE_RHINO_DIRECTION(a2)
		move.w	#RHINO_STATUS_WALK_LEFT,THIS_SPRITE_STATUS(a2)
		bra	.exit

.method_set_walk_right:
		move.w	#RHINO_GO_RIGHT,PRIVATE_RHINO_DIRECTION(a2)
		move.w	#RHINO_STATUS_WALK_RIGHT,THIS_SPRITE_STATUS(a2)
		bra	.exit

.method_set_sweep_direction:
		move.w	#-1,DISKARM_DISABLE
		move.w	RYGAR_XPOS,d2					; d2 = 114
		add.w	#16,d2						; centre of Rygar
		cmp.w	SPRITE_PLOT_XPOS(a1),d2				; xpos = 80
		ble.s	.method_set_sweep_right
		bra.s	.method_set_sweep_left

.method_set_sweep_right:
		move.w	#RHINO_STATUS_SWEEP_RIGHT,THIS_SPRITE_STATUS(a2)
		bra	.exit

.method_set_sweep_left:
		move.w	#RHINO_STATUS_SWEEP_LEFT,THIS_SPRITE_STATUS(a2)
		bra	.exit

.method_set_bones:
		move.w	#RHINO_STATUS_BONES,THIS_SPRITE_STATUS(a2)
		bra	.exit

.method_set_stun_direction:	
		move.w	#TIGER_STUN_STATIC_TIME,PRIVATE_RHINO_STUN_TIMER(a2)		; Set timer
		tst.w	PRIVATE_RHINO_DIRECTION(a2)
		bmi.s	.method_set_stun_left
		bra.s	.method_set_stun_right

.method_set_stun_left:
		move.w	#RHINO_STATUS_STUN_LEFT,THIS_SPRITE_STATUS(a2)
		bra	.exit

.method_set_stun_right:
		move.w	#RHINO_STATUS_STUN_RIGHT,THIS_SPRITE_STATUS(a2)
		bra	.exit

.method_set_grab_left:
		move.w	#RHINO_GO_LEFT,PRIVATE_RHINO_DIRECTION(a2)
		move.w	#RHINO_STATUS_GRAB_LEFT,THIS_SPRITE_STATUS(a2)
		move.w	#RHINO_GRAB_TIME,PRIVATE_RHINO_TIMER(a2)
		subq.w	#1,PRIVATE_RHINO_GRABS(a2)
		bra	.exit

.method_set_grab_right:
		move.w	#RHINO_GO_RIGHT,PRIVATE_RHINO_DIRECTION(a2)
		move.w	#RHINO_STATUS_GRAB_RIGHT,THIS_SPRITE_STATUS(a2)
		move.w	#RHINO_GRAB_TIME,PRIVATE_RHINO_TIMER(a2)
		subq.w	#1,PRIVATE_RHINO_GRABS(a2)
		bra	.exit

.method_set_turn_delay:
		move.w	#RHINO_STATUS_TURN_DELAY,THIS_SPRITE_STATUS(a2)
		move.w	#RHINO_TURN_DELAY_TIME,PRIVATE_RHINO_TIMER(a2)
		bra	.exit

.method_set_grab_delay:
		move.w	#RHINO_STATUS_TURN_DELAY,THIS_SPRITE_STATUS(a2)
		move.w	#RHINO_GRAB_DELAY_TIME,PRIVATE_RHINO_TIMER(a2)
		bra	.exit

.method_set_collision_action:
		tst.w	RYGAR_FALLPREV_STATE				; Is Rygar falling on enemy
		bmi.s	.method_set_stun_or_destroy			; Yes!

		IFNE	DISABLE_ENEMY_COLLISION
		bra	.exit
		ELSE
		bra.s	.method_set_rygar_death_sequence
		ENDC

.method_set_stun_or_destroy:
		tst.w	PRIVATE_RHINO_STUN_TIMER(a2)			; If enemy already in timer
		bpl	.exit

		clr.w	RYGAR_FALL_STATE				; Stop Falling
		move.w	#-1,RYGAR_JUMP_STATE				; Start Jumping	
		clr.w	RYGAR_SINE_INDEX				; Reset Jump Sine pointer.

		GET_PLAYER_SPRITE_CONTEXT
		move.w	#SPRITE_INSTATE_JUMPING,THIS_SPRITE_STATUS(a0)	; Set to jumping.
; Check here if Rygar has Tiger power.

		move.w	RYGAR_CURRENT_POWERS,d2
		and.w	#POWER_TIGER,d2
		bne	.method_set_sweep_direction			; If Rygar has Tiger then enemy is destroy
		bra	.method_set_stun_direction			; If not then the enemy is stunned.
		nop

.method_set_rygar_death_sequence:
		tst.w	RYGAR_DEAD_STATE
		bmi 	.exit				; Rygar already dead!
		move.w	#-1,RYGAR_DEAD_STATE
		clr.w	RHINOS_IN_USE
		clr.w	RYGAR_SINE_INDEX
		GET_PLAYER_SPRITE_CONTEXT
		move.w	#RYGAR_DEATH,THIS_SPRITE_STATUS(a0)	
		bsr	STOP_TUNE
		moveq	#SND_RYGARDEAD,d0		; Play jump sample
		bsr	PLAY_SAMPLE
		bra	.exit
.exit:		rts
mcgeezer is online now  
Old 10 February 2019, 20:10   #674
mcgeezer
Registered User

 
Join Date: Oct 2017
Location: Sunderland, England
Posts: 1,639
After re-writing the sprite animation methods things are becoming a lot more fruitful. It is much easier now for me to create and manage new sprites.


Straight out of WinUAE

http://109.228.4.199/rygar_sq.mp4

Youtube...

[ Show youtube player ]

As you can see the AGA/1200 can push around plenty of sprites.

I've done practically no optimisations either...

Still plenty of bugs though - but looking good for now.

Geezer

Last edited by mcgeezer; 10 February 2019 at 20:26.
mcgeezer is online now  
Old 10 February 2019, 20:21   #675
mcgeezer
Registered User

 
Join Date: Oct 2017
Location: Sunderland, England
Posts: 1,639
Quote:
Originally Posted by Amigajay View Post
Btw whats going on with the lava? Is that a recent change? Or is a bit buggy the way it moves back and forwards?
That's what it does in the arcade Jay.
mcgeezer is online now  
Old 10 February 2019, 20:28   #676
Reido
Registered User

 
Join Date: Feb 2013
Location: Dublin/Ireland
Posts: 296
Top work!
Reido is offline  
Old 10 February 2019, 20:32   #677
DamienD
Global Moderator

DamienD's Avatar
 
Join Date: Aug 2005
Location: London / Sydney
Age: 43
Posts: 16,540
Quote:
Originally Posted by mcgeezer View Post
After re-writing the sprite animation methods things are becoming a lot more fruitful. It is much easier now for me to create and manage new sprites.


Straight out of WinUAE

http://109.228.4.199/rygar_sq.mp4

Youtube...

[ Show youtube player ]

As you can see the AGA/1200 can push around plenty of sprites.

I've done practically no optimisations either...

Still plenty of bugs though - but looking good for now.

Geezer
Wow, looking friggin' awesome Graeme!!!

Quote:
Originally Posted by Amigajay View Post
Btw whats going on with the lava? Is that a recent change? Or is a bit buggy the way it moves back and forwards?
It's the lava men moving through the lava; Graeme hasn't implemented them coming to the surface as yet

DamienD is online now  
Old 10 February 2019, 20:45   #678
dlfrsilver
CaptainM68K-SPS France
dlfrsilver's Avatar
 
Join Date: Dec 2004
Location: Melun nearby Paris/France
Age: 42
Posts: 8,334
Send a message via MSN to dlfrsilver
Quote:
Originally Posted by mcgeezer View Post
After re-writing the sprite animation methods things are becoming a lot more fruitful. It is much easier now for me to create and manage new sprites.


Straight out of WinUAE

http://109.228.4.199/rygar_sq.mp4

Youtube...

[ Show youtube player ]

As you can see the AGA/1200 can push around plenty of sprites.

I've done practically no optimisations either...

Still plenty of bugs though - but looking good for now.

Geezer
Beautiful job ! starting on the A1200 was clearly the way to go !
dlfrsilver is online now  
Old 10 February 2019, 21:47   #679
malko
Ex nihilo nihil

malko's Avatar
 
Join Date: Oct 2017
Location: CH
Posts: 2,602
Quote:
Originally Posted by mcgeezer View Post
After re-writing the sprite animation methods things are becoming a lot more fruitful. It is much easier now for me to create and manage new sprites.
Straight out of WinUAE
http://109.228.4.199/rygar_sq.mp4
[...]
As you can see the AGA/1200 can push around plenty of sprites.
I've done practically no optimisations either...
Still plenty of bugs though - but looking good for now.
Geezer
Mate, your work is awesome !
Also your re-write is top as the rhinos and others enemies now respect the landscape
malko is offline  
Old 11 February 2019, 01:51   #680
JuanLuis
Registered User
 
Join Date: Dec 2018
Location: Málaga
Posts: 45
You proof that the game is technically posible in A1200. The waterfall looks awesome. It's better than the original
JuanLuis is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
Entry: Rygar AGA Edition mcgeezer Coders. Entries 75 28 February 2019 21:41
On the Ball - World Cup Edition AGA djcasey request.Old Rare Games 4 25 January 2013 13:39
On The Ball League Edition AGA , Player Manager 2 StarEye Games images which need to be WHDified 11 22 January 2010 19:21
The Vague #1 AGA-RTG edition is released ! kas1e Amiga scene 12 30 October 2007 01:27
On The Ball: World Cup Edition AGA CodyJarrett request.Old Rare Games 11 27 May 2003 07:14

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 14:37.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.
Page generated in 0.17910 seconds with 16 queries