Page 1 of 1

I need to know HOW?

PostPosted: Fri May 27, 2011 9:55 am
by jcflysrc
In the demo Hblade posted up of the Mario game, I notice bad guys going back and forth on platfroms. How do I do this? Also, I tried to create a Collision event with a cloned actor, and all clones were killed. Like for example, the diamonds in the Cave Man tutorial. Do I have to make and name each diamond individually? Sorry for the noob questions. Any help is appreciated though. Peace.

Re: I need to know HOW?

PostPosted: Fri May 27, 2011 10:05 am
by Game A Gogo
You're most likely destroying your diamond actor with a collision event.
In that case, you probably put in the name of the diamond actor in the destroy actor action!
Doing so will delete all actors, even clones, to prevent this and only destroy actors he collides with, use "collide actor" instead!

Re: I need to know HOW?

PostPosted: Fri May 27, 2011 10:14 am
by jcflysrc
OK, yeah thats what I did wrong..thanks for that. Now how do I make an enemy move left to right on a platform? If I can get that I would be happy. Thanks :D !

Re: I need to know HOW?

PostPosted: Fri May 27, 2011 10:31 am
by jcflysrc
OK, sorry to be a pain. I don't understand what to do. I have my main character, and I am giving him the Collision event/ any side of actor "flying saucer"/ Add Destroy Actor/ "flying saucer". All my cloned saucers disappear when he collides with one of them. I don't see a Collide Actor option. Or am I blind? Don't understand your directions.

Re: I need to know HOW?

PostPosted: Fri May 27, 2011 10:35 am
by jcflysrc
I've tried putting the collision event on both actors seperately, and got the same result.

Re: I need to know HOW?

PostPosted: Fri May 27, 2011 10:59 am
by jcflysrc
Never mind I got it. But I still need to know how to make a character move left to right. Not the main character, but an enemy, like the snake in caveman. Thanks. Step by step. I know how to use wire frame to change path, but I cant figure out how to create the character.

Re: I need to know HOW?

PostPosted: Fri May 27, 2011 11:31 am
by savvy
try using x+= or x-= for movement, and blockers to make the enemy change directions. or you could make it so they move only if their within a certain range of the character:
Code: Select all
if(player.x<x&&player.x>x-200)
{
x-=1;
}

that would make the enemy move left if the player is on its left and within 200 pixels on its left.
Code: Select all
if(player.x>x&&player.x<x+200)
{
x+=1;
}

that would make the enemy move right if the player is on its left and within 200 pixels on its right.
to create an enemy, just clone it. with the collision destroy things, try making them on the enemy's and leaving it as "Event Actor"that way it only destroys the actor whos event it is, so the one which is colliding. create enemys also by using the create actor event and colliders.
have a canvas, then when the player touches it, it makes an enemy say... 300 pixels to the right of it. that way it is made at the right time.

Re: I need to know HOW?

PostPosted: Fri May 27, 2011 11:54 am
by jcflysrc
have a canvas, then when the player touches it, it makes an enemy say... 300 pixels to the right of it. that way it is made at the right time.


This is what I have been trying to do, but I have failed. The actor being created always appears at the collision with the wire frame. I cant control where it is created at. If you could be more specific, that would be nice. Like exactly what steps I need to take, or codes invovlved in making this happen. Thanks.

Re: I need to know HOW?

PostPosted: Fri May 27, 2011 1:37 pm
by savvy
on collision with creator canvas/region ->
Code: Select all
CreateActor("enemy", "animation", "(none)", "(none)", collide.x+300, collide.y, true);

that help?
it makes the enemy 300 pixels along from the creator, and its y point is at the top of the creator...
if you want it to be center of the creator use this:
Code: Select all
CreateActor("enemy", "animation", "(none)", "(none)", collide.x+300, collide.y+(collide.height/2), true);

adds half the height of the creator onto the y value, so centered to the creator.

Re: I need to know HOW?

PostPosted: Fri May 27, 2011 2:08 pm
by Hblade
What I did was:
I had the character hit the sides of a filled region actor. If collision with left:
Code: Select all
if (animindex!=0) { //if animation is NOT equal to move-right
    ChangeAnimation("Event Actor", "MOVERIGHT", FORWARD); //I forgot the actual change animation code :3
    xvelocity=3;
}

Same with left cept' for the other animation. cloneindex!=1 // change left, etc.