Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Snirpa

#2
I have a room with a lake which you cannot cross. The only way to cross the lake is to find a hovercraft. So once the character has the hovercraft and interacts it I change the view with the character inside the hovercraft. This is not a problem.

Now when the character goes back to the room with the lake I want them to be able to cross it, so I cloned that room and made the area above the lake a walkable area.
What I am trying to do, when the character leaves a room I want to write a conditional statement, based on which view my character has (for example, the character has now 'equipped' the hovercraft so he is in that view, thus when he leaves on the left edge, he will be sent to the cloned room, but if he still has the normal walking view, he will go to the original room which he cannot cross.

I have tried

Code: ags


function room_LeaveRight()
{
 if (cEgo.View == 1)){
cEgo.ChangeRoom(4, 43, 323);
else
cEgo.ChangeRoom(7, 43, 323);
 }
}



or

Code: ags


function room_LeaveRight()
{
 if (cEgo.View(1)){
cEgo.ChangeRoom(4, 43, 323);
else
cEgo.ChangeRoom(7, 43, 323);
 }
}


I'm new to coding - I just wish I knew how to set it up correctly.

;-D
#3
Thanks again :) :)
#4
Doh.

Thanks Khris, that was indeed the mistake.

Feeling silly but happy because my house now has blinking lights :)
#5
Hi there,

I'm exhausted googling and searching for an answer..I must be doing something simple wrong.

I want Set a view to an object. It is a simple house with some flashing lights. I want it to activate as the character enters the room.

Code: ags
 

function room_Load()
{
Object[0].SetView(3); 
Object[0].Animate(1, 3);

}

I get the following error.

Failed to save room room2.crm; details below
room2.asc(7): Error (line 7): fixed size array cannot be used in this way

I want to have a house in the background with some animated lights on it. My sprites are fine and I've created a View for them. Not I just want them to correspond with the object I placed.

Sorry for being such a noob.
SMF spam blocked by CleanTalk