Event: once only

Talk about making games.

Event: once only

Postby Fenrir » Sat Feb 05, 2005 8:27 pm

ok, so I got my player to walk against some sarkophags, and as player collides with one of them it will open. Problem is that this event will repeat itself for as long as my player collides with the sarkophag. I want it to open only once, but still keep the physical response between actors.
Help me.. anyone, please I'll buy you a car if you do!
Fenrir
 
Posts: 34
Joined: Thu Feb 03, 2005 3:42 pm
Location: Sweden
Score: 0 Give a positive score

Postby brutalDeluxe » Sat Feb 05, 2005 11:28 pm

on player collision with sarkophag

script
physical response ( player only )
change anim ( open sarkophag )

Perhaps while adding the collision event you selected "repeat while colliding".

Image
User avatar
brutalDeluxe
 
Posts: 43
Joined: Sun Dec 12, 2004 7:43 am
Score: 0 Give a positive score

Postby Fenrir » Sun Feb 06, 2005 9:32 am

This doesn't stop the sarkophag from opening at every and each collition.

Thanks anyway man! :wink:
Fenrir
 
Posts: 34
Joined: Thu Feb 03, 2005 3:42 pm
Location: Sweden
Score: 0 Give a positive score

Postby ingsan » Sun Feb 06, 2005 5:35 pm

Try to create a variable coll_once.

On create, coll_once = 0 ;

On collision, coll_once ++ ; // sarekophag opens when coll_once == 1

if coll_once > 2, coll_once = 2; // No more collision actions
User avatar
ingsan
 
Posts: 580
Joined: Mon Nov 17, 2003 4:02 pm
Location: Maurician LADY in FRANCE
Score: 6 Give a positive score

Postby Fenrir » Sun Feb 06, 2005 7:29 pm

ingsan wrote:Try to create a variable coll_once.

On create, coll_once = 0 ;

On collision, coll_once ++ ; // sarekophag opens when coll_once == 1

if coll_once > 2, coll_once = 2; // No more collision actions


I don't understand how or for whom I should put this into the script. :?
Fenrir
 
Posts: 34
Joined: Thu Feb 03, 2005 3:42 pm
Location: Sweden
Score: 0 Give a positive score

Postby Fenrir » Sun Feb 06, 2005 7:48 pm

Nevermind, I found another solution by destroying the sarkophag on inpact and creating a new sarkophag.

But thanks for your help!
Fenrir
 
Posts: 34
Joined: Thu Feb 03, 2005 3:42 pm
Location: Sweden
Score: 0 Give a positive score

Postby ingsan » Mon Feb 07, 2005 8:12 am

On your_Actor A :
On event CreateActor, Action Script >
    coll_once = 0 ;
On event Collision (with sarkophag), Script >
    coll_once ++ ;
    if (coll_once > 2)
    {
    coll_once = 2 ;
    }
On actor Sarkophag :
on event DrawActor, Script >
    if (coll_once == 1)
    {
    ChangeAnimation(your animation) ;
    }
User avatar
ingsan
 
Posts: 580
Joined: Mon Nov 17, 2003 4:02 pm
Location: Maurician LADY in FRANCE
Score: 6 Give a positive score

Postby Fenrir » Mon Feb 07, 2005 11:44 am

ingsan wrote:On your_Actor A :
On event CreateActor, Action Script >
    coll_once = 0 ;
On event Collision (with sarkophag), Script >
    coll_once ++ ;
    if (coll_once > 2)
    {
    coll_once = 2 ;
    }
On actor Sarkophag :
on event DrawActor, Script >
    if (coll_once == 1)
    {
    ChangeAnimation(your animation) ;
    }


I want to keep the physical response to the sarkophag, but only change animation upon the first collition.
Fenrir
 
Posts: 34
Joined: Thu Feb 03, 2005 3:42 pm
Location: Sweden
Score: 0 Give a positive score

Postby micro » Mon Feb 07, 2005 1:14 pm

add an animation finish event

"add"
"animation finish"
(the animation that opens sarkophag)
"add action"
"change animation"
Actor: sarkophag
Animation: sarkophag(not the one that opens the sarkophag)
direction: forward
"add"
"immediate action"

i hope this will work :D
micR0 was here

visit my homepage: http://micr0.isgreat.tv
micro
 
Posts: 39
Joined: Fri Dec 24, 2004 12:04 am
Location: norway
Score: 0 Give a positive score

Postby ingsan » Mon Feb 07, 2005 2:50 pm

On your_Actor A :
On event CreateActor, Action Script >
    coll_once = 0 ;

On event Collision (with sarkophag), Script >

    Physical Response ;
    coll_once ++ ;
    if (coll_once > 2)
    {
    coll_once = 2 ;
    }

On actor Sarkophag :
on event DrawActor, Script >

    if (coll_once == 1)
    {
    ChangeAnimation(your animation) ;
    }
User avatar
ingsan
 
Posts: 580
Joined: Mon Nov 17, 2003 4:02 pm
Location: Maurician LADY in FRANCE
Score: 6 Give a positive score

Postby Fenrir » Mon Feb 07, 2005 3:05 pm

Thanky Ingsan, so very much!
I know you had your hopes up for the car, but alas there is none. If I ever get one, I'll send it to you. Any requests of model?
Fenrir
 
Posts: 34
Joined: Thu Feb 03, 2005 3:42 pm
Location: Sweden
Score: 0 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest