actor behavior Grab and Throw how to create with blocks

Behappy859

  • Posts: 51
Hello,
I am new to stencil and I love this software. I'm trying to make a game similar to Mario. However, I cannot figure out how to create a grab and throw behavior with the blocks. If someone could help me, I would really appreciate it. I need my character to be able to jump on the enemy, grab and throw him to other enemies like in Mario. I really can't figure out the logic blocks on that if it's there.
thank you

merrak

  • *
  • Posts: 2738
There's going to be a lot of logic involved in this, so it'd be best to think about breaking it down into individual problems and solving one at a time. I'm thinking you'll need behaviors that achieve each of the following:

Detect when the player has jumped on an enemy and if the grab button is held down
Attach the two actors (enemy and player)
Launch the enemy when the player hits the right control
Determine when an enemy has been thrown so that, when the enemy collides with another, the enemies are killed

The first one should be the easiest, since it would only be a modification of the "jump on enemy" that the crash course walks you through. The others can be tricky, particularly if you're new to Stencyl and aren't yet familiar with how events work, how collision detection and collision groups work, and how animations are managed.

Behappy859

  • Posts: 51
There's going to be a lot of logic involved in this, so it'd be best to think about breaking it down into individual problems and solving one at a time. I'm thinking you'll need behaviors that achieve each of the following:

Detect when the player has jumped on an enemy and if the grab button is held down
Attach the two actors (enemy and player)
Launch the enemy when the player hits the right control
Determine when an enemy has been thrown so that, when the enemy collides with another, the enemies are killed

The first one should be the easiest, since it would only be a modification of the "jump on enemy" that the crash course walks you through. The others can be tricky, particularly if you're new to Stencyl and aren't yet familiar with how events work, how collision detection and collision groups work, and how animations are managed.
hi I know it took awhile to reply from the hints you gave me and want to say thank you for the hints. I ended up making a grab and throw behavior for my player I still feel like I did something wrong. I ended up creating a couple of Booleans and a actor attributes. reason why cause when I click on the enemy for the actor attribute on the scene it doesn't work for the other same enemy in the scene just only the one I clicked on. could I get some help on what I did wrong please. I took a picture of it I'm a try to figure out how to post it. thank you.

Behappy859

  • Posts: 51
my grab and throw I behavior I created.

Behappy859

  • Posts: 51
also if I try other ways I thought could work my player actor falls through the tiles and off screen.

mpeterskc

  • Posts: 22
As a beginner myself, I've found that with complex behaviors like this it can be easier to create multiple actors with specific functions that can be killed and created depending on what you need to do. For instance, you could instead kill the actor you're picking up, and upon that actors death create a new actor that represents the actor you've picked up, then when your player throws that actor you kill it and upon that actors death create a new actor that will collide with enemies and tiles, then if that actor comes to a stop without colliding with an enemy, kill it and upon its death, the original actor is created once again. I doubt it's the most elegant way of doing things but I bet you could get it to work.

Behappy859

  • Posts: 51
thank you for your words of knowledge, that gave me a whole new perspective on how it could work. I worked on it since 7 am yesterday figured out 3 different ways of trying to make it work. I am going to try the kill actor and create actor way.

merrak

  • *
  • Posts: 2738
Do you have a playable demo you can upload to the Stencyl arcade? It'd be easier to see what's going wrong.

Behappy859

  • Posts: 51
Do you have a playable demo you can upload to the Stencyl arcade? It'd be easier to see what's going wrong.
I think I can do that. right now it has 5 stages for the first level which was going to be my demo. ill see what I can do. never uploaded a demo but ill figure it out. thank you

Behappy859

  • Posts: 51
Do you have a playable demo you can upload to the Stencyl arcade? It'd be easier to see what's going wrong.
its on my profile page hope I did it right

Behappy859

  • Posts: 51
Do you have a playable demo you can upload to the Stencyl arcade? It'd be easier to see what's going wrong.
its also a key board game no mouse needed hit jump button(z) to accept to go to next scene. (enter) is pause

Behappy859

  • Posts: 51
here is one of the newest updates I tried for the grab and throw behavior. my player can hit the enemy pick up the enemy and throw the enemy. however if the player is away from the enemy after the enemy has been hit, the player can still pick up the enemy but they fall through the tiles..... I just recently bought 2 books called "Stencyl Essentials and Beginners guide to Stencyl 3.0" went through them in 2 days and I'm starting to feel a little burnt out. I have been puzzled working on this behavior and in 7 days it has slowed my progress down. I really need some help please.

Behappy859

  • Posts: 51
Do you have a playable demo you can upload to the Stencyl arcade? It'd be easier to see what's going wrong.
just wanted to get back to you. I just now put the game out called Euka as working progress. and I also set it to where you hit new game it will automatically go to the stage that has the mosquitos. the mosquito is the enemy that can be grabbed and thrown. for controls its in the description under the game. thank you

Rimrook

  • Posts: 251
The complexities of this is comical, even I never really figured out a solid behavior. Eventually I settled on having the player actor just boot things along with his shoe. It’s pretty stupid, and stupid fun.

There is a “points” extension that might help. You can define a point to attach things to. That would cut down on manual input and help things along. Hope you find a good solution, curious how things will work out :)

Behappy859

  • Posts: 51
The complexities of this is comical, even I never really figured out a solid behavior. Eventually I settled on having the player actor just boot things along with his shoe. It’s pretty stupid, and stupid fun.

There is a “points” extension that might help. You can define a point to attach things to. That would cut down on manual input and help things along. Hope you find a good solution, curious how things will work out :)
Its finished