CP - Alen Breed Remake - 6

Miscellaneous Forums/Blitz Showcase/CP - Alen Breed Remake - 6

- players are given default weapons upon creation
- Players can die and leave behind a temporary dead body (they fade away) Edit: There used to be a seperate deadbody.bb file but then I realised I could just use your particles..

Re-jig the order in the engine.bb with these bits: The weapons get created before we make the players so we can equip the weapon when we create the players.
btext 40,190,"Clearing VIS...":Flip
ClearVis()


btext 40,200,"Creating Weapons...":Flip
; create the weapons we want in the game
;createWeapon.weapon...
;		...(id,name$,				dmg#,maxclp,aiac,	rate,speed#,bullettype,	frame,s1$="",s2$="",s3$="")
createWeapon(1,weaponBroadhurst,    1.5, 	5, 	25, 	100, 3.0, 	2,			21, "sfx\mgun.mp3", "", "sfx\pistolreload1.mp3")
createWeapon(2,weaponDalton,    	10.0,	1, 	25,  	500, 6.3, 	1,			22, "", "", "")
createWeapon(3,weaponRobinson,  	8.0, 	5, 	25, 	300, 7.6, 	0,			23, "", "", "")
createWeapon(4,weaponRyxx,      	0.4, 	5, 	25, 	100, 3.0, 	-1,			24, "", "", "")
createWeapon(5,weaponStyrling,  	1.5, 	5, 	25, 	100, 3.0, 	3,			25, "", "", "")
createWeapon(6,weaponImpact,    	1.5, 	5, 	25, 	100, 3.0, 	3,			26, "", "", "")




; **************** TEMP BIT ******************
; create 20 aliens in random places
If False
btext 40,210,"Creating aliens...":Flip
For n=1 To 10
	Repeat
		x=Rand(100,2000)
		y=Rand(100,2000)		
	Until gettile(x,y,0)=0 
	spawnalien(x,y,n,Rand(2,3))
Next
EndIf
; ************ End of TEMP BIT ***************


btext 40,220,"Creating Player/s...":Flip
;Player Initialization - name, x, y, id
Player_Create.player("meeeeee",player_one_start_x,player_one_start_y,1,"light")
;Player_Create.player("player3",player_two_start_x,player_two_start_y,2)


Change this bit in players.bb. It gives the player their default weapon depending on their class:
	Select Lower(kind)
		Case "light":
			filename$="gfx/player2.png"			
			allowPlayerToHaveTheseWeapons(pl,1+2+4) ; all weapons
			speed#=1.5
			;default weapon when you start
			giveWeaponToPlayer(pl,getWeaponFromName(weaponBroadhurst))
			
		Case "medium"
			filename$="gfx/player3.png"
			allowPlayerToHaveTheseWeapons(pl,4+8+16) ; all weapons
			speed#=1.0
			giveWeaponToPlayer(pl,getWeaponFromName(weaponRobinson))
			
		Case "heavy"
			filename$="gfx/player3.png"
			allowPlayerToHaveTheseWeapons(pl,8+16+32) ; all weapons
			speed#=0.7			
			giveWeaponToPlayer(pl,getWeaponFromName(weaponRyxx))
	End Select	


add this to the top of the particles.bb
Global dead_body_1 = LoadImage("gfx\body.png"): MaskImage dead_body_1,255,0,255



Update this bit in players.bb->affect health
If p\health =< 0 Then
		; rebirth
		p\health = 100
		p\lives=p\lives-1
		
		DebugLog "player "+p\id+" dies..."
		; create dead body here
		createparticle(p\x,p\y,0,0,5000,0,0,dead_body_1,ImageWidth(dead_body_1)/2,1)
	
		; create death splat *temp*
		n=Rand(20)+5
		For i=1 To n
			d=Rand(359)
			f=Rand(12,15)
			createparticle(p\x,p\y,Sin(d)*2,Cos(d)*2,Rand(10,100),f,f,particles,16)	
		Next
		
		; move then to the start position
		If p=First player
			p\x=player_one_start_x
			p\y=player_one_start_y
		Else
			p\x=player_two_start_x
			p\y=player_two_start_y		
		EndIf
			
		; should we allow the player to keep their weapons or 
		; make their weapons drop onto the floor so they can pick them up?		
		
		; play spinny animation here
		If p\lives=0
			; replaced with end of game bit
			Cls
			Print "End of game"
			WaitKey
			End
		EndIf		
	EndIf	
End Function

Also, you might want to change this in the script.bb->handleRunningScripts functions to only draw when in debugmode
		If debugmode 
			dcircle(i\x*32,i\y*32,32,255,0,0)
			dtext(i\x*32,i\y*32,i\l+"/"+i\loops)	
		EndIf