Actor dragging another actor?

FetusCommander

  • Posts: 5
I'm trying to make it so that my main player character can drag around an object when the drag key is held down, but i'm having some issues with it.  I tried modifying the "Seek Target" behavior from the forge.  Attached is what it looks like.

First off, i'm not sure this is the best way to do it.  Anyone have any suggestions? 

Second, whenever i run my game with my modified version of this behavior, not only does it not work, but it also slows the game down to a crawl.  This seems to happen whenever i use key down/up blocks.

Alexin

  • *
  • Posts: 3130
When testing, hit the key ~ to display the console. Are there any errors?
"Find the fun"
alexin@stencyl.com

FetusCommander

  • Posts: 5
Yep, looks like there's the same one over and over again:

Cannot access a property or method of a null object reference

Alexin

  • *
  • Posts: 3130
You're already checking if the actor is alive, which is a good thing. Additionally, check if it has a value.
The IF should like [if target has no value  OR not target is alive].

The block you'll need is in the category Attributes > Functions. You can also search for "has value" or "has no value".
"Find the fun"
alexin@stencyl.com

FetusCommander

  • Posts: 5
Looks like your suggestion fixed the errors, but i'm still having trouble getting the player to drag the object.  Is there some way to set the variable "Target" to the id of the actor i want the actor with this behavior to follow?