Please login or register.

Login with username, password and session length
Advanced search  

News:

For WME related articles and tutorials visit WME Resource Center.

Author Topic: dropping and picking up objects within a scene  (Read 3177 times)

0 Members and 1 Guest are viewing this topic.

SBOVIS

  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 404
  • FORGET REALITY SURRENDER TO YOUR DARKEST DREAMS
    • View Profile
    • LIMBO of the LOST
dropping and picking up objects within a scene
« on: June 17, 2004, 09:08:49 AM »

Hi all.
        I was wondering if anyone had some code or ideas how the scene can be defined for item placement.
For example the player can pickup a coin from the floor and drop it anywhere else on the floor or on a table etc. Not just in the place where the player found it (WME DEMO  - with the book object)

Also when the player picks up or drops an item depending on the area clicked on the character will perform different animations.
Example: Drops/picks up item on floor -character animation = crouches down
             Drops/ picks up item on table/ledge etc - character animation = pickup/drop standing
             Drops/ picks up item high up - Character animation = pickup/drop stretching on tip toe.


Many thanks to all at the forum for the help that is given.

Regards

Steve

I JUST LOVE THIS ENGINE!!!     
Logged
kind Regards
Steve Bovis
MAJESTIC STUDIOS

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: dropping and picking up objects within a scene
« Reply #1 on: June 17, 2004, 10:24:26 AM »

Well, it's a little tricky. I think you'd have to at least define several areas where the item can we put to, such as, floor, table, etc. because (naturally) the engine doesn't know which area of the screen is a high place and which is not.
So, define those areas as region entites (making them interactive), name them omething like "floor", "table"... and handle using the item on them in their script (see below).
Next, you need a scene entity representing the dropped item (similarly to the book item in WME demo). Let's assume the name of this entity is "coin_entity" and the name of the coin inventory item is "coin_item".

Then the script attached to those scene areas (i.e. the region entities) would look something like:

Code: [Select]
#include "scripts\base.inc"

on "coin_item"
{
  // play the right animation depending on what area did we click
  switch(this.Name)
  {
    case "floor": actor.PlayAnim("drop_crouch.anim"); break;
    case "table": actor.PlayAnim("drop_stand.anim"); break;
    // some more cases here
  }
 
  // remove the item from inventory
  Game.DropItem("coin_item");
   
  // and place the entity where the player clicked within the scene
  var Ent = Scene.GetNode("coin_entity");
  Ent.X = Scene.MouseX;
  Ent.Y = Scene.MouseY;
}


This is a very rough description but hopefully it will give you some ideas how to implement it.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

SBOVIS

  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 404
  • FORGET REALITY SURRENDER TO YOUR DARKEST DREAMS
    • View Profile
    • LIMBO of the LOST
Re: dropping and picking up objects within a scene
« Reply #2 on: June 17, 2004, 10:31:24 AM »

Thanks Mnemonic will give this my best shot and let the forum know the outcome.

Steve
Logged
kind Regards
Steve Bovis
MAJESTIC STUDIOS
 

Page created in 0.046 seconds with 19 queries.