Upgrades

00george

  • Posts: 161
Hi I cant seem to get my shop working I have 2 behaviours the button one and the runright one I cant seem to get that when I click on the button it increases my speed. I will post my pictures below. One other thing the button is on a different scene from where the dinosaur is which uses the runright behaviour.

« Last Edit: January 18, 2012, 09:43:36 am by 00george »

Hectate

  • *
  • Posts: 4643
1. Use mouse "is released" or "is pressed" so the message is sent only once. "is down" will send a message for every frame that the mouse button is down so your speed will get added to a great deal more than intended.

2. You may have to use the internal name for the behavior, which I believe should just be "_run".
:
:
Patience is a Virtue,
But Haste is my Life.
Proud member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.

00george

  • Posts: 161
I have changed what you said but the speed still wont increase

Hectate

  • *
  • Posts: 4643
Do this for me. Put a "Print" block inside your "When this hears Faster" block and put something simple like "Going Faster!" inside. When testing the game press ~ (or whichever key is below ESC on your keyboard) to open the console and try testing then. Let me know if the message you put in the print block shows up as you would expect it to if the message was received correctly.
:
:
Patience is a Virtue,
But Haste is my Life.
Proud member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.

00george

  • Posts: 161
the message does not show up

Hectate

  • *
  • Posts: 4643
I see the problem now.

You're telling the button's behavior to send a message to "Self" but the "run" behavior is certainly on the player actor instead. You need to send the message to the player actor instead.
:
:
Patience is a Virtue,
But Haste is my Life.
Proud member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.

00george

  • Posts: 161
How do I send it to the player actor isntead?


Hectate

  • *
  • Posts: 4643
Sorry, I had been posting on lunch break and have been away from my desk since.

Try following the instructions in the following post to assign the player actor to an attribute in your button's behavior.

For the enemies' "Chase Player" behavior, I'd recommend the following since you're only ever likely to have 1 player at a time.

Create an attribute of the type Actor. Name it "Player" or something similar.

Under "When Created", drop in the wrapper block "For Each Actor Of Type" and select your player's actor type in its selection box.

Inside that wrapper block, put the attribute setter block for "Set Player To" and put the "The Actor" block (from the same section of the palette as the wrapper block itself) as the actor to set the attribute to.

What'll happen is whenever an enemy using this behavior is created, it'll check the entire scene for all the actors of your player type and assign the one that it finds (or the LAST one that it finds, in case of multiple) to the "Player" attribute. Once you have done that, at any other point in time (such as during gameplay) you can get the Player attribute's location information via all the other Actor blocks such as the X and Y that you need by telling it to use the Player attribute instead of the default of "Self".

I'd give you an example but I'm afraid I don't have access to SW here at work right now. At one point I had created a simple example behavior for someone that did exactly this (Enemy Chases Player) that was on Forge, but it may have been lost in the transition to launch.
:
:
Patience is a Virtue,
But Haste is my Life.
Proud member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.

00george

  • Posts: 161
Thanks for all this help but now when I click this button I get a bunch of errors.

Hectate

  • *
  • Posts: 4643
Can you show us your updated behavior and tell us what the errors say?
:
:
Patience is a Virtue,
But Haste is my Life.
Proud member of the League of Idiotic Stencylers; doing things in Stencyl that probably shouldn't be done.

00george

  • Posts: 161
Sorry That I have not replied for a while. The updated behavouirs are in the first post.

00george

  • Posts: 161
Also the errors are in the console and there are hundreds I think there something about the always section of the button behaviour.