Fast and Furry-ous help


#1

Can anyone help me with this code? My pet and I need to run faster than the ogre, but I cannot move until after my pet does. Is there a way for me and my pet to move at the same time? Any help would be appreciated.
This is the code I have right now:

var enemy = hero.findNearest(hero.findEnemies());
pet.moveXY(50, 21);
hero.jumpTo(enemy);
hero.moveXY(50,30);

#2

@Coder There sure is.

Remember the levels you finished in the forest campaign world?

Return to a level like The Long Road and review the pet. functions and how we were controlling the pet.


#3

There are two ways to solve it. You need “non-blocking” actions. So try to use Harry’s advice or find other boots :wink:


#4

The path to this is confusing me, and I think perhaps it is an overlooked quirk of the two account options. I am not currently signed up for the upgraded account (plan to, but not this month).

I played all the available levels in the forest world, and none of them were “The Long Road”, nor have I been able to find that level in any way other than to click the link in Harry’s comment. I vaguely recall one previous level with a pet, but do not recall learning any specific commands for the pet, only that it could function as another person to be commanded other than “hero” in commands already used for the hero in previous levels.

I therefore conclude that either a) I’m blind (which is distinctly possible) and the non-upgraded account path didn’t require I complete The Long Road. or b) that level is not accessible to non-upgraded users unless they have a direct link (which seems an odd way to set it up).

It does seem (from my own perspective as an academic tutor) that if one is going to rely on information gained in that level (or group of levels - others seem to be referenced but not named here, but I couldn’t find them either) that one aught to require that level prior to relying on the student possessing that information.
Alternatively if one chooses to eliminate the training level from the un-upgraded accounts, then one aught not to require that game-specific information in order to progress in the un-upgraded path (which Fast and Furri-ous seems to do).
I am also confused because I seem to have a pet (because it has appeared in two levels), but I also seem not to have a pet in that it is grayed out. Also I can not click on it (like I can on my other tools) to find out what phrases it “grants”, which would be my usual workaround to solve this lack of information problem.

If I have missed an entire section, can someone please direct me to where I can find it?

Also, is there somewhere I can find a list of the available commands for the pet?

I am about to go play “The Long Road” in hopes that will solve my confusion.

UPDATE:
Even more confused.
Seem to be able to get to levels that require the pet (The Long Road via link and Fast and Furri-ous as a required part of the desert), but do not seem to have the .fetch(item) function available in either place.


#5

@AuntJeanne, eventually a large portion of our Pet-based levels will be subscriber exclusive, we are currently testing their completion rates amongst the adventurous public. We have a long chain of Pet levels in the Forest designed to get players familiar with their familiars, and are now starting to expand Pet mechanics into further campaigns. Nearly all Pet levels are not required to advance through the game, and will be optional side-quests and levels for players. The few that will be required are going to be the first few of the Forest branch to demonstrate what players are missing out on by not being subscribers.

In our Classroom version this whole process will be streamlined so students will learn Event callbacks by the time they finish Course 2, and can use this knowledge to complete future levels we may include in further courses.

If you’re having trouble seeing the pet APIs, it’d be great if you included a screenshot and expected behavior and submitted a bug report at our issue tracker on GitHub: https://github.com/codecombat/codecombat/issues


#6

I’ve looked back to long-road, that’s actually a bit confusing to me as well:
pet.on('spawn', fetchPotions) looks like a hook registry to me.
But I didn’t trigger the event my self.
Looks like it’s registering the hook and triggering it at the same time…
Or have I missed something?


#7

Hey guys, yeah, the ones who know very well how to code…
To us beginners who have only a few months of coding experience, all the knowledge that you take for granted is not very obvious.So please don’t be so cryptic
For the sake of our learning, can you please delineate what pet functions are available?
The fetchItem function is great, but that function is useless in the Fast and the Furry-ous because there is nothing for the pet to fetch.
I have tried using flags for the hero to move without the pet, and that didnt work
any other hints please?


#8
# spoiler
# create a `petMove` function with `event` argument 
# implement it with pet's `moveXY` method
# rigster `spawn` event with `petMove` function

If you can’t figure out with the above spoiler, please PM me and I can explain further.


#9

Could you explain it, please? There should be potions.

It triggers for the first frame, so yes.


#10

@Sinogermany,
Thank you very much for this, I initially created a function for the pet to chase the enemy, and the one thing that I forgot to do was type “event” in the parenthesis at the end of the function.
why is it important to have “target” or “event” in the parenthesis of our functions?

Thanks again!


#11

Are you using Python or JS?


#12

@Chef9529 I do not see where the event is required when creating the function.

However it looks like the event object can have the following structure:

event {
    type : "spawn",
    target : Object
}

The event object gets passed to the function that is used for the call back. If we choose to have event in the parenthesis of the function, “a parameter”, then we can make use of the event object in our function.

For example in this particular case:

event.target would be the pet object. Like the hero object the pet object has a pos, health, id, type, etc.

event.type = "spawn"
event.target.id = "Kitty"
event.target.type = "cougar"
event.target.health = 10
event.target.pos.x = 9
event.target.pos.y = 21

This might be useful in more advanced levels if you have to know how much life your pet had.


#13

Yep. For example, for “hear” you can recognize who said the heard phrase.


#14

I am struggling with this level as well - Desert, Python, Fast and Furry-ous - and I can’t work it out:


#15

When ever I play this level it keeps telling me that the function petMove is not defined.

-- Use an event handler so pet and hero will both run!
function petMove(event)
    pet:moveXY(50, 21)
end

-- Use pet.on("spawn", petMove) instead of petMove().
-- This way your hero and pet will run at the same time.
 -- ∆ Replace this with pet.on("spawn", petMove)
pet.on("spawn", petMove())
hero:moveXY(50, 12)


thats the code Im using


#16

Do you see the difference? :wink: