Freedom Fighter - Rise of humans *WORK IN PROGRESS*

Страница 1/6
| 2 | 3 | 4 | 5 | 6

By thegeps

Champion (272)

Аватар пользователя thegeps

13-04-2019, 22:38

Yep. My (future) game now has a name! Now is more than a vertical scrolling routine, so here's a new thread Smile
I've just added collision detect from player sprite with enemy sprites (next will be collision between player's bullets and enemy sprites) and player respawn. It isn't a big add but just another step is done!
Here's a new video, recorded in HD from openMSX, so remember to select HD option when watching. Enjoy!

https://youtu.be/1Kym00Sn02w

Для того, чтобы оставить комментарий, необходимо регистрация или !login

By MISXTOR

Champion (386)

Аватар пользователя MISXTOR

13-04-2019, 23:07

Awesome scroll!!!
Great work, I hope to see your game finished.
Congratulations.

By thegeps

Champion (272)

Аватар пользователя thegeps

13-04-2019, 23:31

Thank you MISXTOR!

By Sandy Brand

Master (156)

Аватар пользователя Sandy Brand

14-04-2019, 11:02

Ooh nice smooth scroll Smile

By thegeps

Champion (272)

Аватар пользователя thegeps

14-04-2019, 12:00

Thank you Sandy
I'm really proud of it Big smile

By erpirao

Paladin (945)

Аватар пользователя erpirao

14-04-2019, 12:06

It's incredible, I can not wait to play the final version.

By Wlcracks

Champion (325)

Аватар пользователя Wlcracks

14-04-2019, 12:39

msx1 nice...

By valkyre

Champion (419)

Аватар пользователя valkyre

14-04-2019, 13:57

Looks really promising.

By thegeps

Champion (272)

Аватар пользователя thegeps

24-04-2019, 22:34

New video released. Added central shot collision. Now are visible some sprites' bugs (I don't know from where they are... need to investigate). And I tried to implement diagonal shots collision too, but it didn't work (yet). Basically the code use the same routine to detect collisions, only main target changes. So, first it checks collision between player sprite coordinates (sprite 0/1, same coordinates) and enemies coordinates (sprites 20-31). Second time it compares sprite 6 coordinates (central shot) with enemies coordinates (sprites 20-31). And all work (less or more, I noticed some sprites bugs when recording this video, probably related to active sprites/free sprites to use). When I tried to do the same with sprite 7 or 8 (diag sx and diag dx shots) nothing happened... some clues/hints? I can paste here the collision routine code. Tell me.

https://youtu.be/KERbOpxjOhM

By thegeps

Champion (272)

Аватар пользователя thegeps

24-04-2019, 23:42

collision:
	push	af	;save all registers
	push	bc
	push	de
	push	hl
	ld	hl,ramspttbl+48	;point to first enemy (sprite 12) ypos
	ld	de,actpat+36	;point to active flag of sprite 12 (first enemy sprite)
	ld	b,20	;max enemy sprites (from 12 to 31)
check_upper_y:
	ld	a,(de)
	or	a
	jp	z,to_next
	push	hl
	ld	a,(hl)	;load enemy ypos in a
	add	a,-14	;add -14 for upper line of collision rectangle
	ld	c,a	;upper line in c
	ld	l,0	;point to player ypos
	ld	a,(hl)	;player1 ypos in a
	cp	c	;cp player ypos with upperline of rectangle
	jr	nc,check_bottom_y
	pop	hl	;point to enemy ypos
to_next:
	inc	e	;increment de to point to next sprites infos
	inc	e	;in actpat table (3 values for sprite)
	inc	e	;1st: 1/0 active/unactive 2nd: pattern movement nr 3:pattern position
	ld	a,l	;increment hl to point to next sprite in SAT (ramspttbl)
	add	a,4
	ld	l,a
from_dead:
	djnz	check_upper_y	;repeat until checked all enemies sprites
	ld	a,(0e5cfh)	;check you_are_dead flag
	or	a
	jp	z,not_dead	;if zero go to not_dead
	ld	l,0		;else point to ramspttbl (first value, sprite0 ypos)
	ld	(hl),190	;set player ship ypos when dead
	inc	l		;point to xpos
	ld	(hl),119	;and do the same
	ld	l,4		;for sprite1 too (player ship second color sprite)
	ld	(hl),190	
	inc	l		
	ld	(hl),119
	pop	hl
	pop	de
	pop	bc
	pop	af		;restore saved registers and return to main
	ret
check_bottom_y:
	ld	c,a	;player ypos in c
	pop	hl	;point to enemy ypos
	ld	a,(hl)	;enemy ypos in a
	add	a,14	;add 14 for bottom line of collision rectangle
	cp	c
	jr	nc,check_left_x
	jp	to_next
check_left_x:
	inc	l	;point to enemy xpos
	push	hl
	ld	a,(hl)	;enemy xpos in a
	add	a,-14	;set most left axis for collision zone
	inc	l
	inc	l
	bit	7,(hl)	;check if early bit clock is set
	jp	z,no_ebc
	sub	32	;if so subtract 32 from enemy xpos
no_ebc:
	ld	c,a	;enemy xpos in c
	ld	l,1	;point to player xpos
	ld	a,(hl)	;player1 xpos in a
	cp	c	;compare player xpos with left x of collision rectangle
	jr	nc,check_right_x
	pop	hl
	dec	l
	jp	to_next
check_right_x:
	ld	c,a	;player xpos in c
	pop	hl	;point to enemy xpos
	ld	a,(hl)	;enemy xpos in a
	add	a,14	;set right border of collision rectangle
	inc	l
	inc	l
	bit	7,(hl)	;check for early bit clock (same of leftx check)
	jp	z,no_right_ebc
	sub	32
no_right_ebc:
	dec	l
	dec	l
	cp	c
	jr	nc,dead
	dec	l
	jp	to_next
dead:
	inc	l
	ld	(hl),72	;set first frame of axplosion sprite
	inc	l
	ld	a,(hl)	;color+ebc in a
	or	11	;change only color for explosion (leave ebc as is)
	ld	(hl),a	;set it in ramspttbl
	inc	e	;point to second actpat value (pattern nr)
	ld	a,7
	ld	(de),a	;set it as 7 (explosion animation)
	inc	e	;point to next actpat value (pattern frame)
	xor	a
	ld	(de),a	;set it to 0 (first frame)
	ld	a,1
	ld	(0e5cfh),a	;set you_are_dead flag
	inc	l	;inc hl to next sprite first value
	inc	e	;inc de to next sprite actpat first value
	jp	from_dead	
not_dead:
	ld	l,48	;point hl to sprite 12 ramspttbl (SAT)
	ld	e,36	;point de to sprite 12 actpad
	ld	b,20	;nr of enemy sprites to check

from here the routine is the same from "check_upper_y" with different labels' names that check collision between central shot and anemy ships...

By thegeps

Champion (272)

Аватар пользователя thegeps

25-04-2019, 21:07

Made some changes:

ship_collision:
	ex	af,af'
	exx
	ld	hl,ramspttbl+48	;point to first enemy (sprite 12) ypos
	ld	de,actpat+36	;point to active flag of sprite 12 (first enemy sprite)
	ld	b,20	;max enemy sprites (from 12 to 31)
check_upper_y:
	ld	a,(de)
	or	a
	jp	z,to_next
	push	hl
	ld	a,(hl)	;load enemy ypos in a
	add	a,-14	;add -14 for upper line of collision rectangle
	ld	c,a	;upper line in c
	ld	l,0	;point to player ypos
	ld	a,(hl)	;player1 ypos in a
	cp	c	;cp player ypos with upperline of rectangle
	jr	nc,check_bottom_y
	pop	hl	;point to enemy ypos
to_next:
	inc	e	;increment de to point to next sprites infos
	inc	e	;in actpat table (3 values for sprite)
	inc	e	;1st: 1/0 active/unactive 2nd: pattern movement nr 3:pattern position
	ld	a,l	;increment hl to point to next sprite in SAT (ramspttbl)
	add	a,4
	ld	l,a
from_dead:
	djnz	check_upper_y	;repeat until checked all enemies sprites
	ld	a,(0e5cfh)	;check you_are_dead flag
	or	a
	jp	z,not_dead	;if zero go to not_dead
	ld	l,0		;else point to ramspttbl (first value, sprite0 ypos)
	ld	(hl),190	;set player ship ypos when dead
	inc	l		;point to xpos
	ld	(hl),119	;and do the same
	ld	l,4		;for sprite1 too (player ship second color sprite)
	ld	(hl),190	
	inc	l		
	ld	(hl),119
not_dead:
	ex	af,af'		;restore saved registers and return to main
	exx
	ret
check_bottom_y:
	ld	c,a	;player ypos in c
	pop	hl	;point to enemy ypos
	ld	a,(hl)	;enemy ypos in a
	add	a,14	;add 14 for bottom line of collision rectangle
	cp	c
	jr	nc,check_left_x
	jp	to_next
check_left_x:
	inc	l	;point to enemy xpos
	push	hl
	ld	a,(hl)	;enemy xpos in a
	add	a,-14	;set most left axis for collision zone
	inc	l
	inc	l
	bit	7,(hl)	;check if early bit clock is set
	jp	z,no_ebc
	sub	32	;if so subtract 32 from enemy xpos
no_ebc:
	ld	c,a	;enemy xpos in c
	ld	l,1	;point to player xpos
	ld	a,(hl)	;player1 xpos in a
	cp	c	;compare player xpos with left x of collision rectangle
	jr	nc,check_right_x
	pop	hl
	dec	l
	jp	to_next
check_right_x:
	ld	c,a	;player xpos in c
	pop	hl	;point to enemy xpos
	ld	a,(hl)	;enemy xpos in a
	add	a,14	;set right border of collision rectangle
	inc	l
	inc	l
	bit	7,(hl)	;check for early bit clock (same of leftx check)
	jp	z,no_right_ebc
	sub	32
no_right_ebc:
	dec	l
	dec	l
	cp	c
	jr	nc,dead
	dec	l
	jp	to_next
dead:
	inc	l
	ld	(hl),72	;set first frame of axplosion sprite
	inc	l
	ld	a,(hl)	;color+ebc in a
	or	11	;change only color for explosion (leave ebc as is)
	ld	(hl),a	;set it in ramspttbl
	inc	e	;point to second actpat value (pattern nr)
	ld	a,7
	ld	(de),a	;set it as 7 (explosion animation)
	inc	e	;point to next actpat value (pattern frame)
	xor	a
	ld	(de),a	;set it to 0 (first frame)
	ld	a,1
	ld	(0e5cfh),a	;set you_are_dead flag
	inc	l	;inc hl to next sprite first value
	inc	e	;inc de to next sprite actpat first value
	jp	from_dead	

Now there aren't (or it seems there aren't) sprites' bugs. Now I have splitted collision routine in 3. I have the same routine with renamed labels: ship_collision (working), cshot_collision(working) and lshot_collision (partial working). And soon I'll have a rshot_collision (just tried by modifying values that point to shotsprite in lshot_collision and less or more it have same problems of lshot_collision). I can record and post a video if you need.
Please, help Crying (probably something stupid I don't get/see)

Страница 1/6
| 2 | 3 | 4 | 5 | 6