Any suggestions to how to animate triggered draw_0 to draw_3 brush/object?

Need help with using DizzyAGE then look here
macon
Hard Boiled Egg
Posts: 174
Joined: Mon Apr 30, 2007 1:08 pm
Location: Grimsby, England

Post by macon » Tue Oct 19, 2010 3:52 pm

When Dizzy approaches Zaks he collides with an invinsible hotspot which turns on the lightening and disables the hotspot. I know you want to trigger it in a different way the principles the same.

Ignore the second collision. The second collision is to reset the lightening bolt if Dizzy leaves the screen. This was my first game and at that time I didn't that there is a special function for events on leaving the screen.

The lightening moves in the room update for that location. It just moves the lightening then checks if it has reached the screen end. If so it is moved bac to the beginning. But you could also disable it at this point if you wanted.

Captain Jonesy
Your Backpack is Empty
Posts: 29
Joined: Mon Feb 15, 2010 12:27 pm

Post by Captain Jonesy » Tue Oct 19, 2010 5:02 pm

Ok sure, I understand about invinsible hotspot ( that's cool way to trigger things by the way, I use that in the future). I'm currently looking at your Update room lightening bolt code and that's gone over my head.

Code: Select all

func UpdateRoom_14_2()
{
    bolt = ObjFind(2181);
    if ((!ObjGet(bolt,O_DISABLE)) && (ObjGet(bolt,O_STATUS)<2))
    {
        ObjSet(bolt,O_X,ObjGet(bolt,O_ X) +1);
        if (ObjGet(bolt,O_ X) >=3600) ObjSet(bolt,O_X,3428);
    }
    if ((!ObjGet(bolt,O_DISABLE)) && (ObjGet(bolt,O_STATUS)>0))
    {
        ClearKeys();
    }
    if ((!ObjGet(bolt,O_DISABLE)) && (ObjGet(bolt,O_STATUS)==2))
    {
        ObjSet(bolt,O_X,ObjGet(bolt,O_ X) -1);
        if (ObjGet(bolt,O_ X) <=3416)
        {
            ObjSet(ObjFind(2180),O_ANIM,1);
            ObjSet(bolt,O_DISABLE,1);
            PlayerSet(P_TILEIDLE,10);
            PlayerSet(P_TILE,10);
        }
    }
    if (ObjGet(ObjFind(2180),O_FRAME) == 11) ObjSet(ObjFind(2180),O_DISABLE,1);
}
Sorry I'm newbie at this; this is quite advanced for me, so I'm just wondering what you what code would you suggest to make flame go right to left on screen and disables crossing the screen once? Sorry to be pain, I just really stuck :v2_dizzy_eek:

macon
Hard Boiled Egg
Posts: 174
Joined: Mon Apr 30, 2007 1:08 pm
Location: Grimsby, England

Post by macon » Tue Oct 19, 2010 5:29 pm

I'd forgotten there was a bit more than the lightening movement going on in that room.

1st you neede to check if the lightening has been enabled. if it has then move it. Finally check to see if has reached the edge of the screen. If so disable it.

Code: Select all

bolt = ObjFind(2081); // use the correct id for the lightening
if (ObjGet(bolt,O_DISABLE) == 1) return; // lightening is not active so exit
ObjSet(bolt,O_X,ObjGet(bolt,O_ X) -1); // move lightening left
if (ObjGet(bolt,O_ X) <=3416) // use x coordinate where you want lightening to vanish.
{
ObjSet(bolt,O_DISABLE,1); // lightening disappears
}

Captain Jonesy
Your Backpack is Empty
Posts: 29
Joined: Mon Feb 15, 2010 12:27 pm

Post by Captain Jonesy » Tue Oct 19, 2010 8:49 pm

Thank you very much Macon, that works really well, you're been really helpful :v2_dizzy_thumbsup: .

Just to ask you one more thing (sorry to keep asking questions, I promise this will be my last question), how would you enable the flame movement again for each different item given to the dragon? Currently the flame can be activated with movement across screen only once within player duration (any single item) but I need to enable the flame movement for each item given.

It's item puzzle you see, two items lead to the player's death with the flame and one item leads to player pass the dragon.
Here is the code written for the flame trigger and giving the item to the dragon which triggers the flame (each item has the same code):

Code: Select all

func UpdateRoom_1_3() 
{
idx = ObjFind(1004); ///// Dragon flame
if(ObjGet(ObjFind(1004),O_STATUS)==1)
{
if (ObjGet(idx,O_DISABLE) == 1) return; /// flame is not active so exit
ObjSet(idx,O_X,ObjGet(idx,O_ X) -3); /// moves left
if (ObjGet(idx,O_ X) <=250) /// where the flame vanishes.
ObjSet(idx,O_DISABLE,1); /// flame disappears
 } 
}
func UseObject_1003( idx )
{
if(idx==ObjFind(104))////skull
	{
	    InventorySub(idx);
Message2(5,6,"So I have no problem\nkilling you"); MessagePop(); 
		idx = ObjFind(1004);//flame
		ObjSet(ObjFind(1004),O_DISABLE,0);
		ObjSet(ObjFind(1004),O_STATUS,1); // enable flame loop 
		ObjSet(ObjFind(1004), B_DRAW, 3); //Draw flame
		ObjSet(ObjFind(1004), B_MATERIAL, 3);
 GameCommand(CMD_REFRESH);  					
I would of thought these lines for each item:
idx = ObjFind(1004);//flame
ObjSet(ObjFind(1004),O_DISABLE,0);
ObjSet(ObjFind(1004),O_STATUS,1);

would allow the flame to loop back to orignal status with:
if(ObjGet(ObjFind(1004),O_STATUS)==1)
within the Update room? But that doesn't work, any suggestions? Thanks again in advance!

Jonesy

macon
Hard Boiled Egg
Posts: 174
Joined: Mon Apr 30, 2007 1:08 pm
Location: Grimsby, England

Post by macon » Tue Oct 19, 2010 9:15 pm

When the flame reaches the end of the screen and you disable it, have you tried resetting its O_X property, setting the status to zero and also resetting any other properties that has changed such as draw and material. In other words put everything back to how it was before the flame was triggered.

Not sure if that is what you need.

Captain Jonesy
Your Backpack is Empty
Posts: 29
Joined: Mon Feb 15, 2010 12:27 pm

Post by Captain Jonesy » Wed Oct 20, 2010 11:13 am

Yeah good idea - I didn't think of that approach although what code would you use to reset the O_X property/location? Sorry I'm such a newbie at this, here is my code so far:

Code: Select all

idx = ObjFind(1004); ///// Dragon flame
if(ObjGet(ObjFind(1004),O_STATUS)==1)
{
if (ObjGet(idx,O_DISABLE) == 1) return; /// flame is not active so exit
ObjSet(idx,O_X,ObjGet(idx,O_ X) -3); /// moves left
if (ObjGet(idx,O_ X) <=250) /// where the flame vanishes.
ObjSet(idx,O_DISABLE,1); /// flame disappears              
ObjSet(ObjFind(1004),O_STATUS,0);  
} 
if(ObjGet(ObjFind(1004),O_STATUS)==0)
{
ObjSet(ObjFind(1004), B_DRAW, 0); //Draw flame
ObjSet(ObjFind(1004), B_MATERIAL, 0); 
ObjSetPos(434,486); 
This line: ObjSetPos(434,486); doesn't change it's location by default, suggestions? Thanks again and again in advance lol :v2_dizzy_happy:

Jonesy

delta
Hard Boiled Egg
Posts: 3965
Joined: Fri Feb 09, 2007 7:08 pm
Location: North West
Contact:

Post by delta » Wed Oct 20, 2010 1:03 pm

O_X is simply just another Object property, so you just need to use ObjSet(idx,O_X,434);
Image

Image

"Quotes from the internet may not be genuine" - Abraham Lincoln

delta
Hard Boiled Egg
Posts: 3965
Joined: Fri Feb 09, 2007 7:08 pm
Location: North West
Contact:

Post by delta » Wed Oct 20, 2010 1:06 pm

also, these two lines will throw up errors:

Code: Select all

ObjSet(ObjFind(1004), B_DRAW, 0); //Draw flame
ObjSet(ObjFind(1004), B_MATERIAL, 0); 
this is because you're trying to change brush properties (B_) using code for objects (ObjSet). Use both parts of the object code (ObjSet & O_) for Dynamic Objects, and both parts of the brush code (BrushSet & B_) for Static Brushes.
Image

Image

"Quotes from the internet may not be genuine" - Abraham Lincoln

Captain Jonesy
Your Backpack is Empty
Posts: 29
Joined: Mon Feb 15, 2010 12:27 pm

Post by Captain Jonesy » Wed Oct 20, 2010 2:39 pm

Thanks delta again, oh yeah you're right - of course, the flame is a object so I changed all accordingly. Macon I just tried that with this recent attempt;

Code: Select all

idx = ObjFind(1004); ///// Dragon flame
if(ObjGet(ObjFind(1004),O_STATUS)==1)
{
if (ObjGet(idx,O_DISABLE) == 1) return; /// flame is not active so exit
ObjSet(idx,O_X,ObjGet(idx,O_ X) -3); /// moves left
if (ObjGet(idx,O_ X) <=250) /// where the flame vanishes.
ObjSet(idx,O_DISABLE,1); /// flame disappears              
ObjSet(ObjFind(1004),O_STATUS,0);  
} 
else
if(ObjGet(ObjFind(1004),O_STATUS)==0)
{
ObjSet(ObjFind(1004),O_DRAW,0); //Draw flame
ObjSet(ObjFind(1004),O_MATERIAL,0); 
ObjSet(idx,O_X,434);
 } 
}
Currently you see the flame appear but resets to draw and material 0 instantly, not travelling across screen anymore, so I guess ObjSet(ObjFind(1004),O_STATUS,0); is overriding the movement function, any ideas? :dizzy_confused:

Jonesy

delta
Hard Boiled Egg
Posts: 3965
Joined: Fri Feb 09, 2007 7:08 pm
Location: North West
Contact:

Post by delta » Wed Oct 20, 2010 3:27 pm

yes, you're right, so you also need to change the status property back to 1:

Code: Select all

ObjSet(ObjFind(1004),O_STATUS,1);
Simple! :)
Image

Image

"Quotes from the internet may not be genuine" - Abraham Lincoln

Post Reply