Author Topic: drawing a gun  (Read 2199 times)

0 Members and 1 Guest are viewing this topic.

Bloodfang

  • Guest
drawing a gun
« on: December 07, 2002, 05:37:42 PM »
Hello. I am having some troubles with a caracter I am working on in AGI. I want him to draw a gun, but every cycling command line I have tried, doesn't work. As soon as I call for the gun to be drawn, you have to move the character around to see the animation but it plays over and over again, and it looks pretty stupid. My goal is to type in "draw gun" and have the character draw his weapon and keep it out until I give the command "holster weapon." Can anyone help me out with this problem. Thank you for taking the time to read my question.

Bloodfang



Offline Andrew_Baker

Re:drawing a gun
« Reply #1 on: December 07, 2002, 06:18:53 PM »
Some of the object commands act strangely when applied to the ego.  My solution would be to:

if (said("draw","gun")) {
    animate.obj(o1);
    load.view(drawing_gun);
    set.view(o1, drawing_gun);
    position.v(o1, new_ego_x, new_ego_y);
    erase(ego);
    draw(o1);
     program.control();
    end.of.loop(o1, done_flag);
     }

if (done_flag) {
    reset(done_flag);
    load.view(ego_drawn_gun);
    set.view(ego, ego_drawn_gun);
    erase(o1);
    draw(ego);
    player.control();
}

That's a bit of a kludge, because it doesn't deal with putting away the gun or memory problems associated with repeatedly drawing and holstering your gun.  So, load all views and animate the drawing/holstering object in the if (new_room) {} block of your code :D.

But, it should give you a starting point.
I hope you realize that one day I will devour the Earth.

Offline bokkers

Re:drawing a gun
« Reply #2 on: December 08, 2002, 01:36:47 AM »
You guys could use the good old f31 aka always_animate_ego. It should be what you need. Just be sure to reset f31 when the player character is supposed to walk normally again.

Pikachu14

  • Guest
Re:drawing a gun
« Reply #3 on: December 08, 2002, 05:52:18 AM »
Can't you just take the code from Police Quest I?

David

  • Guest
Re:drawing a gun
« Reply #4 on: December 08, 2002, 11:56:57 AM »
Take a look at my code in "Dave's Quest". In scene 2, whenever you use the remote control to turn on the tv, I switch to a different view in order to "draw the remote control". It's not a gun, but it is the same similar sort of thing.


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

Page created in 0.09 seconds with 22 queries.