Zelda Like-like monster

Schulz561

New member
Hi everyone,

I'm creating an adventure game much like Zelda and there's one enemy I'm trying to replicate, the like-like. It's a monster that doesn't damage you, but rather sticks to you and eats your shield. In my case the monster will take your money until you destroy it. Any suggestions on how to achieve this? I already have the money and the ability to collect it, just need the monster code help.

Thanks,
Matt
 

dale_coop

Moderator
Staff member
A lot of easy ways to start doing that...
If your LIKE LIKE monster is small (1 8x8px sprite for example) and not animated, you could use the PreDraw to draw a sprite next to/on your prlayer -- like for the sprite-based weapon--Technically, when your player touches the monster, you use set flag or activate a variable. And in the preDraw, if this flag or variable is activated, you draw the sprite.
Another possibility would be to make a AI monster script, that places the monster on the same spot than the Player. Assign this Action your monster Action Step (1 or 2 or anything) that loops. So, when your player touches the monster, the monster changes to this Action Step. (always following the Player... and you could also put the DECREASE money in that script).
..
 

dale_coop

Moderator
Staff member
For example... a monster that sticks to the player and sucks his money:

1 / make a new "MoneySucker.asm" script in your "ModuleScripts\AiScripts" folder, with something like:
Code:
	STX tempx
	
	LDX player1_object
	LDA Object_x_hi,x
	STA temp1
	LDA Object_y_hi,x
	CLC
	ADC #$01
	STA temp2
	LDA Object_timer_0,x
	BNE +
		;; check if still money (the 3 digits are greater than 0):
		LDA myMoney+2
		BNE ++
		LDA myMoney+1
		BNE ++
		LDA myMoney
		BNE ++
		JMP noMoreSuckingAction
		++
		;; DECREASE Money:	
		SubtractValue #$03, myMoney, #$01, #$00	;; decreases 1 unit of money (here, myMoney is displayed as 3 digits)
		;; update HUD:
		LDA #$01
		STA hudElementTilesToLoad
		UpdateHud HUD_myMoney	
	+
	
	LDX tempx
	LDA temp1
	STA Object_x_hi,x
	LDA temp2
	STA Object_y_hi,x
    LDA #$00	
	STA Object_movement,x
	JMP endSuckingAction
	
noMoreSuckingAction:
	LDX tempx
	ChangeObjectState #$00,#$02	;; change back to normal :
		
endSuckingAction:

Assign thas script to an unused "AI Action" element in "Project settings > Script settings" and give a proper label to that action (for example "Money Sucker" in "project labels").

2/ Modify your "HandleObjectCollision.asm" script, just after the line "yesPlayerObjectCollision:", add this :
Code:
yesPlayerObjectCollision:
	;; if the monster in collision is a SUCKER, he's goes to sucking state:
	LDA Object_type,x
	CMP #SUCKER_MONSTER				;; <<-- id of the sucker monster (requires a new "SUCKER_MONSTER" user constant to set the value.. monster's ids start from 16)
	BNE +
	;; sticks to the player / sucks his money.... if not already:
	LDA Object_action_step,x
	AND #%00000111
	CMP #$05	;; <<-- 05 is my action step with sucking animation
	BEQ +	
	ChangeObjectState #$05,#$02	;; <<-- 05 is my action step with sucking animation
	+

3/ Modify your sucker monster (needs to be set as "monster"), "no player collision" to all the Action steps (to not harm the player). Then set an unused action step (in my example I used the action Step 5), set its Action "Sucking", End of Animation "Repeat", animation speed "2" (maybe, will also be the speed of sucking).

VoilĂ ... I think if your player touches the monster (#SUCKER_MONSTER), he sticks to the player and sucks his money... until no more money or player shoots him...? The player leaves the screen (current limitation)...
 

WillElm

New member
I'm thinking you could use these methods to make a "shield/block" function? Something like Zelda 2.

310523-zelda-ii-the-adventure-of-link-nes-screenshot-when-fighting.png


Anyone remember the fights between Link and these shield knight guys, who had a high and low block, and there was recoil and stuff? Something like this is way off for me and probably wouldn't really fit my game right now, but it's something I've wondered about. I need some way to do full on object parenting...

Does the predraw method give you something like this? Or is it incorporated without taking object properties into account; as in, it's not an object, just a sprite?

Imagine a 2 player vs. game that's like nidhogg combined with zelda 2 fighting combined with stamina oriented dark souls-ish fighting.
 
Top Bottom