Show Posts

You can view here all posts made by this member. Note that you can only see posts made in areas to which you currently have access.


Topics - dayowlron

Pages: [1]
1
I will have several doors in my game so I created a function that I will call that will open and close my doors. Later when I get to adding sound I will put that in the one spot and will work for all my doors. All of my doors have a 5 image(frames numbered 0-4) animation for opening and closing. When a room loads I set the view for the door and then when the player wants to open or close the door I just call the function. When the door is open there is another walkable area that is enabled that allows them to go through the door. It is disabled when the player closes the door. This is where the problem occurs.
Code: Adventure Game Studio
  1.  
  2. static function OpenDoor(Object*obj, int WalkableAreaToEnable) {
  3.   if (obj.Frame==0) {
  4.     obj.Animate(obj.Loop, 5, eOnce, eNoBlock, eForwards);
  5.     if (WalkableAreaToEnable!=0) RestoreWalkableArea(WalkableAreaToEnable);
  6.   }
  7. }
  8.  
  9. static function CloseDoor(Object*obj, int WalkableAreaToDisable) {
  10.   if (obj.Frame==4) {
  11.     obj.Animate(obj.Loop, 5, eOnce, eNoBlock, eBackwards);
  12.     if (WalkableAreaToDisable!=0) RemoveWalkableArea(WalkableAreaToDisable);
  13.     player.PlaceOnWalkableArea();
  14.   }
  15. }
  16.  

My problem is when the walkable area is removed and then i call player.PlaceOnWalkableArea sometimes it works sometimes it doesn't.
I have walkable area #1 always available so its not like it can't find a walkable area.

EDIT: I have even tried putting the player.PlaceOnWalkableArea() call in the repeatedly_execute function and verified that it is being called.

2
Beginners' Technical Questions / Object.Name is blank
« on: 15 Jan 2018, 01:09 »
I am having trouble with something. I need to get the object name but it is returning an empty string.
Just including code related to the problem.
Code: Adventure Game Studio
  1.   LocationType l;
  2.   Object *o;
  3.   o=Object.GetAtScreenXY(mouse.x, mouse.y);
  4.   l=GetLocationType(mouse.x, mouse.y);
  5.   if (l==eLocationObject) {
  6.     return String.Format("%d %s",o.ID, o.Name);
  7.   }
  8.  
The object name field is filled in. It is called "oDoor". However my function is returning "1 ".

Pages: [1]