Global and Collisions

Blitz3D Forums/Blitz3D Beginners Area/Global and Collisions

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

This should work ...

;Load Actor(s)

SeedRnd MilliSecs()
For loop = 1 To 15
	a.actor = New actor
	a\entity  = CopyEntity( scifiguy )
	EntityType a\entity,TYPE_BADGUY
	EntityRadius a\entity,rsize#
	Animate a\entity,1,.5,1
	PositionEntity a\entity,Rnd(1,200),32,Rnd(1,290)
	ScaleEntity a\entity,.12,.12,.12
	
	;SG
	NameEntity a\Entity, Handle(a)
	;SG
	
	Print loop
Next

;Shooting the badguy
If CountCollisions(b\sprite)>0 ;this is my bullet

	;SG	
	Entity = EntityCollided(b\sprite,TYPE_BADGUY) ;collisions have been set via Const

	If Entity > 0

		a.actor = Object.actor( EntityName( Entity ) )
		If a <> Null
			enemy_hit_counter=enemy_hit_counter+1
			EmitSound bad_guy_sound,a\entity
			RotateEntity a\entity,0,270,0
			
			If enemy_hit_counter=>1 
				score=score+5115
				PlaySound spawn_sound
				kill_counter=kill_counter+1
				HideEntity a\entity
				TranslateEntity a\entity,0,-200,0
				PositionEntity a\entity,80,-1,-88
				ShowEntity a\entity
			 	enemy_hit_counter=0
			EndIf
			
		EndIf

	EndIf

EndIf