How to make the pig walk by itself

so i need the pig to walk itself but i dont know how

2 Likes

What boundaries do you want the pig to move in? In what direction do you want it to move?
I can answer your problem if you give me the answer to these questions :slight_smile:

2 Likes

Similar to what hihilogic said, It is very difficult to understand what you need help with. If you go into more detail I’m sure we can help you, but right now its pretty vague what you need help with here.

3 Likes

what im trying to say is that i want the pig to move in different direction like up then down the left then right

3 Likes

Hmm, I may have what your looking for. Just give me a little bit, because I can’t be online for too long. Expect a tutorial this evening

3 Likes

Wrong. Expect a tutorial NOW!
Sooooo…
The easy way:
Make 4 blocks. Up, down, left and right.

  • On collision with the Up block, set the X velocity to zero and the Y velocity to a positive number
  • On collision with the Down block, set the X velocity to zero and the Y velocity to a negative
  • On collision with the Left block, set the X velocity to a negative and the Y velocity to zero
  • On collision with the Right block, set the X velocity to a positive and the Y velocity to zero

Hard way:
On once, have an ease to go to specified location. On the end of the ease, start the next ease, and once your eases are done connect them back to the first ease to start the loop again.

3 Likes

Or just use a left and right block and use them to rotate the pig 90 degrees, and -90 degrees…

1 Like

image
Option numero tres has been presented :upside_down_face:

2 Likes

can you give me a picture @hihilogic

3 Likes

I can give you an example that I already have done.

1 Like

sure i can accupted that thanks i was making a sneek peck at the new flowlab night funkin mod i was doing

2 Likes

Sorry, I didn’t have time to make a simpler example; this one is the same concept just with eases, but I didn’t know if you would know how to switch the eases into single values (snap rotation). Sorry, again I hope this works fine:

thx ill try to do some because im running low on space because i have free

3 Likes

Ah, yes. The 50 object limit. One thing you can do to avoid this is have a bunch of extractors on the object’s position, and if it has a certain position it’s able to execute a certain code. A great example of this is the chair in my new-and-improved Three Aspects game. I only used 25 objects, so you should definitely take a look: Flowlab Game Creator - My Three Aspects
Here’s the filter code for the chair (just as a filter example):


Notice the circles. The red circles are position filters, saying, “Is my X position (blank)? If so, turn on the switch to do this.”
The blue circles indicate the level filters, basically saying, “If the level is (blank), then turn on the switch to execute this code”
You’ll also notice that some are mixed and matched to properly execute code.
So basically, it’s one object within the library, it just has filters which allow it to execute multiple pieces of different code.

2 Likes

The same goes for a lot of objects in the Three Aspects game, such as the teacher, table, and shade objects.

1 Like

ok but what this havr to do with me knowing what direction the pig goes?

2 Likes

It doesn’t. Just the fact that you’re running low on blocks. If people have a problem I try to find a solution :slight_smile:

2 Likes

well ok ill try to find one thanks

2 Likes

Very late reply, but to give the pig a more normal look instead of seeming like a robot you can use the Random Behavior between 1 and 4 put that through a filter to find what direction the pig goes. You need to also add a ray cast to see if it’s getting close to any walls to turn around/not go one way. You can also do this for diagonal which will make it look even better. This is a small detail, but it’s the polish like this that makes a game really good.

2 Likes