playMaker

Author Topic: enemy climbing a moving ladder ref:Donkey Kong[Solved]  (Read 722 times)

colpolstudios

  • Sr. Member
  • ****
  • Posts: 370
enemy climbing a moving ladder ref:Donkey Kong[Solved]
« on: September 06, 2023, 03:56:01 PM »
I have created two animations: a ladder going up and a ladder going down, Only the top half of the ladder actually moves and the bottom is stationary.

I use a bool "Move" in the animation controller to move between the two states.

A node placed at the bottom of the stationary ladder is used to detect the entry of the enemy, It has two FSMs "moving ladder" and "waiting for player or enemy"

The "moving ladder" FSM uses a random event to set the "Move" bool false with a wait time of 0.1 and then goes to a new state using another random event with a wait time of 0.1.

This gives the effect of the ladder coming up and down at random times.

If the player is attempting to climb the ladder you just wait until the ladder is either moving towards the up position or already fully up and climb the ladder.

But I'm really having trouble with the enemy and getting the timing just right on every occasion. Sometimes the ladder comes down while the enemy is climbing and it's climbing in empty space.

I think the issues really lie within the animation controller and the current setup I'm using and would really appreciate help, please. 

« Last Edit: October 02, 2023, 03:57:39 PM by colpolstudios »

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: enemy climbing a moving ladder ref:Donkey Kong
« Reply #1 on: September 06, 2023, 05:19:16 PM »
Hi.
You could have some sort of detection (overlap / box cast) to check if an enemy is on the ladder, if so check again after x frames/sec and if none then collapse the ladder.

colpolstudios

  • Sr. Member
  • ****
  • Posts: 370
Re: enemy climbing a moving ladder ref:Donkey Kong
« Reply #2 on: September 07, 2023, 04:34:04 PM »
Instead, I used the player's ability to climb the ladder and stripped it down so that it could work with the enemy.

The ability to climb the moving ladder is now a part of the enemy's FSM.

Tested and works a lot better, but not perfect, Given the amount of time you will be playing within this level it should be okay.

One issue is that if I use a clone of the enemy a set position is ignored.

If I place three duplicates of the enemy this is not the case.

It's not a big issue as I can adapt and use the duplicates, but wonder why I have the issue with the clones as I have a separate fsm on another object that does indeed use the set position correctly on every clone.


djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: enemy climbing a moving ladder ref:Donkey Kong
« Reply #3 on: September 07, 2023, 06:28:02 PM »
How are you cloning?

at runtime you should use prefabs and spawn those, its not good to create objects from an existing object @ runtime.
as it can indeed cause issues.

you can also setup pools if you are reusing enemies (if you have many in a scene)

colpolstudios

  • Sr. Member
  • ****
  • Posts: 370
Re: enemy climbing a moving ladder ref:Donkey Kong
« Reply #4 on: September 09, 2023, 03:00:58 PM »
Thank you so much for pointing out the issue of creating an object from an existing one @ runtime.

I learned some valuable insights along the way and here is my result.


I need some help with the random event and the weight options.

I have two states can go and don't go

can go is set to 0.25

Dont Go is set to 0.3

Every possible location that has the ability to use a ladder uses these same settings.

there are twelve possibilities in total, but I don't have enough experience and wonder could you advise, please.

djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: enemy climbing a moving ladder ref:Donkey Kong
« Reply #5 on: September 10, 2023, 06:39:06 PM »
Hi.
You mean on the enemies 'Can go' on ladder
or ladders to randomly are set?

colpolstudios

  • Sr. Member
  • ****
  • Posts: 370
Re: enemy climbing a moving ladder ref:Donkey Kong
« Reply #6 on: September 12, 2023, 08:27:45 AM »
The ladders on either side of the cage where the flaming oil barrel is located have nodes.

one at the bottom to force the flaming sprite up or don't Go.

Another node at the top also with the same random event settings to force the flaming sprite down and also deactivate the bottom node with a reset on exit checked.

The enemies in this case are the fire sprites and have no control over whether they can climb or not. The abilities are only on the ladders, but the fire sprite has to enter the trigger.

My current settings seem to be working well, but you might with your experience add some advice.



djaydino

  • Administrator
  • Hero Member
  • *****
  • Posts: 7616
    • jinxtergames
Re: enemy climbing a moving ladder ref:Donkey Kong
« Reply #7 on: September 13, 2023, 06:59:17 AM »
Hi.
if it works, its good :)

Maybe you can expand it later to check a tag first and and have certain enemies 'Follow' the player instead of random.
with a simple position check you can see if player is higher/lower

colpolstudios

  • Sr. Member
  • ****
  • Posts: 370
Re: enemy climbing a moving ladder ref:Donkey Kong
« Reply #8 on: September 13, 2023, 09:31:34 AM »
Hi, here is a quick update showing some more progress.


I am surprised at the amount of work that's involved just within one level as each level is like a full game on their own.

I have noticed some outstanding issues when making this level and hopefully will be able to go back to the first level and implement the required changes.



« Last Edit: September 15, 2023, 05:15:25 PM by colpolstudios »