Object labels

digit2600

Member
Do these serve any purpose in code, i.e. I name a monster object bob, and I write a script only for bob... can I call bob by the label in code ?
 

dale_coop

Moderator
Staff member
You can use "call" your objects by names... but by their Object ID (Game Objects start from 0 for the player to 15... then, monster objects from 15 to... ??)
So in a lie like
CreateObject temp, temp2, #16, #$00, currentNametable
Will create your first monster, objectID 16... (or #$10 in hex).
 

mouse spirit

Well-known member
In this regard, how would i ask if player object 1 is colliding with enemy or player object 2. My miaaion ia to say if melee,dont destroy....but if projectile,destroy.Both are objects.I tried this towards the end of handlehurtmonster.asm....

LDA player1_object
CMP #$01
BEQ +
INC limitProjectile
DeactivateCurrentObject
+
 

dale_coop

Moderator
Staff member
In 4.1.5, here's how you can check the type of the object:

Code:
	LDX tempx
	LDA Object_type,x		;; we check the type of the object that is doing the action
        CMP #OBJECT_PLAYER_PROJECTILE	;;#$02  ;; is it a projectile type  object ?
        BNE +				;; if not we skip the destroy object
        ;; what should we do with the projectile?
        INC limitProjectile
        DeactivateCurrentObject
+

Or

Code:
	LDX tempx
	LDA Object_type,x		;; we check the type of the object that is doing the action
	CMP #OBJECT_PLAYER_MELEE	;;#$01  ;; is it a melee type  object ?
        BEQ +				;; if is IS, we skip the destroy object
        ;; what should we do with the projectile?
        INC limitProjectile
        DeactivateCurrentObject
+
 
Top Bottom