Zelda Like-like monster

Post Reply
Schulz561
Posts: 8
Joined: Sun Mar 17, 2019 6:22 pm

Zelda Like-like monster

Post by Schulz561 » Tue May 14, 2019 12:52 am

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
User avatar
dale_coop
Posts: 3491
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: Zelda Like-like monster

Post by dale_coop » Wed May 15, 2019 1:50 pm

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).
..
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE / UNDERGROUND ADVENTURE (Arcade version - Byte-Off-2019)
User avatar
dale_coop
Posts: 3491
Joined: Fri Feb 16, 2018 7:05 am
Location: France

Re: Zelda Like-like monster

Post by dale_coop » Wed May 15, 2019 2:45 pm

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: Select all

	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: Select all

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)...
-----
Sorry about my poor english
All I need: A Damn Fine Cup of Coffee
My games: PRESS START GAME / UNDERGROUND ADVENTURE / UNDERGROUND ADVENTURE (Arcade version - Byte-Off-2019)
WillElm
Posts: 75
Joined: Wed Mar 20, 2019 3:56 am

Re: Zelda Like-like monster

Post by WillElm » Fri May 17, 2019 11:03 pm

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

Image

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.
Post Reply