Author Topic: Newb  (Read 9906 times)

0 Members and 1 Guest are viewing this topic.

Offline gennadiy

Re:Newb
« Reply #15 on: May 27, 2004, 04:53:29 AM »
if (posn(o0,84,73,102,93)) {
>if (posn(oA,x,y,x,y)) {
this code checks that object 0 (ego, character) is positioned on the line what begins from point 84,73 and ends at 102,93.

Offline Joel

Re:Newb
« Reply #16 on: May 27, 2004, 06:29:39 AM »
Wait a second.

The posn command is exactly the same as the obj.in.box command, except that the obj.in.box command tests the entire bottom row of pixels of the object and posn tests the bottom-left pixel only. This is according to the AGI Studio help file.

Basically, the purpose for both commands is to check whether an object is positioned within a rectangular region (as opposed to on a line) on the screen, but from the sound of things obj.in.box is more demanding than posn.

Offline Zagrijs

Re:Newb
« Reply #17 on: May 27, 2004, 12:26:40 PM »
Here is the code:

if (said("sit")) {
  if (posn(o0,45,159,57,126)) {
    if (!isset(f100)) {
      print("You sit down.");
   set.view(ego,2);

    }
    else {
      print("You try to sit down twice, but just hurt yourself. You're not "
            "bendable enough.");
    }
  }
  else {
    print("Your tuchy's not THAT big.");
  }
}
if (isset(f100)) {
  stop.cycling(o2);
}

The bottom left corner of chairs coordinates are 51 159.

Offline Joel

Re:Newb
« Reply #18 on: May 27, 2004, 05:52:26 PM »
I don't know whether this will make any difference, but try specifying it like this:

if (posn(o0, 45, 126, 57, 159))

since the most common way to express rectangular coordinates is x1, y1, x2, y2, where (x1, y1) is usually the top-left corner and (x2, y2) is usually the bottom-right corner.

You're specifying it as bottom-left, top-right. Like I said, I don't know if that will fix your problem, but it's worth trying.

Oh yeah, and just to be clear, you're not testing the bottom-left pixel of the chair. You're testing the bottom-left pixel of o0, i.e. ego to see whether it's within range of the chair.
« Last Edit: May 27, 2004, 05:53:57 PM by Joel »

Offline Joel

Re:Newb
« Reply #19 on: May 27, 2004, 05:57:34 PM »
This comes from the AGI Specs:

posn(n, x1, y1, x2, y2);

TRUE if the coordinates of the base point of the cel which is the current image of the object n satisfies the equation x1 <= x <= x2 and y1 <= y <= y2.

If this is correct, then that would mean that the order that you specify the arguments DOES matter.

Offline Andrew_Baker

Re:Newb
« Reply #20 on: May 29, 2004, 12:11:55 AM »
Download the source.  You can view the game in AGIStudio, but with the source you'll also get the defines and comments, which should help immensely.
I hope you realize that one day I will devour the Earth.

Offline Zagrijs

Re:Newb
« Reply #21 on: May 29, 2004, 02:18:54 AM »
Thanks Joel. I finally got ego to sit. Another question

How can I get the control away from the player after he sits so ego cannot move without taking away typing.

Thanks for holding off with all my questions

Offline Joel

Re:Newb
« Reply #22 on: May 29, 2004, 09:02:02 AM »
I believe the command is program.control(). When you're ready for the player to move again, you have to type player.control().

I don't think either of those turn off the ability to type, which I believe is controlled by prevent.input() and accept.input().

Offline Zagrijs

Re:Newb
« Reply #23 on: May 29, 2004, 09:37:32 AM »
In this case the player can still move and type even if I use program.control.

Here is the code

if (said("sit")) {
  if (posn(ego,50,125,75,160)) {
    if (!isset(f100)) {
      print("You sit down.");
         program.control();
         set.view(ego,2);
         ignore.blocks(ego);
         set.priority(ego,13);
     move.obj(ego,60,137,10,f100);



    }
    else {
      print("You try to sit down twice, but just hurt yourself. You're not "
            "bendable enough.");
    }
  }
  else {
    print("Your tuchy's not THAT big.");
  }
}
if (isset(f100)) {
  stop.cycling(ego);
}

Offline Zagrijs

Re:Newb
« Reply #24 on: May 29, 2004, 01:14:36 PM »
I figured it out and it works except that when it should erase the sitting ego view after the player type stand and then draw the regular ego view again it draws the regular ego view and the face of the regular ego view stays where the view is drawn over the background.

Kon-Tiki

  • Guest
Re:Newb
« Reply #25 on: May 29, 2004, 01:52:13 PM »
player.control();
start.cycling();

You'll need those two in the code for standing back up. Player.control(); will make it so that the player can move ego around again. Start.cycling(); is needed because you needed stop.cycling(); first. It'll start the animation of ego again, while if you wouldn't use it, it'd look like it'd be sliding over the screen, kinda like a paper doll on a stick.

Offline Zagrijs

Re:Newb
« Reply #26 on: May 29, 2004, 02:08:33 PM »
Thanks Kon-Tike but after I posted my previous message I tried everything and 15 minutes after your post it was working.

Thanks again for your help

Kon-Tiki

  • Guest
Re:Newb
« Reply #27 on: May 29, 2004, 03:33:32 PM »
Even better. It means you're making progress in coding in AGI :)


SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.078 seconds with 21 queries.