Please login or register.

Login with username, password and session length
Advanced search  

News:

IRC channel - server: waelisch.de  channel: #wme (read more)

Author Topic: Playing an Enviroment animation  (Read 3310 times)

0 Members and 1 Guest are viewing this topic.

DREAMWEB

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 48
    • View Profile
Playing an Enviroment animation
« on: May 07, 2004, 05:02:06 PM »

I am trying to do something really easy but I can't
There is a dresser in the room. I want that if I click on the drawer the game play an animation: the drawer opening up.
I make the SPRITE file with that animation and put it on the scene (without loop) and each time I go there the drawer "open" automaticaly.

If I put on a SCRIPT:

on "LeftClick"
{
 Game.PlayAnim("escenas\001 - Room\001\01\cajon\cajon.sprite");
 Game.ChangeScene("escenas\001 - Room\001\cajon-tijeras\cajon-tijeras.scene");
 
}

The game shows a LOG error.

Logged

Igorrr

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 130
  • Ugh...Ughugh!!!!!!
    • View Profile
    • Struggle For Life And Honour
Re: Playing an Enviroment animation
« Reply #1 on: May 08, 2004, 04:48:18 AM »

I think the problem is because you try to use the PlayAnim Method with the Game Object.
You can use the PlayAnim Method as far as I know only with Actor, Entity and Item objects.

So instead of using
Code: [Select]
Game.PlayAnim("escenas\001 - Room\001\01\cajon\cajon.sprite");
do instead
Code: [Select]
YourDrawerEntity.PlayAnim("escenas\001 - Room\001\01\cajon\cajon.sprite");
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Playing an Enviroment animation
« Reply #2 on: May 08, 2004, 07:56:22 AM »

I will elaborate on this a bit more:

First, you *must not* assign the open animation directly in scene (in scene edit), because you don't want the drawer to open when entering the scene. Just assign it a static image od a closed drawer in SceneEdit. This is the image which is going to be used most of the time.

Next, the left click handler of the drawer will look the way Igorrr suggested:

Code: [Select]
on "LeftClick"
{
  // query the "drawer" entity; change the name appropriately
  var Drawer = Scene.GetNode("drawer");

  // we want *the drawer* to play the animation, not the Game
  Drawer.PlayAnim("escenas\001 - Room\001\01\cajon\cajon.sprite");

  // and go to another scene
  Game.ChangeScene("escenas\001 - Room\001\cajon-tijeras\cajon-tijeras.scene");
}
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

DREAMWEB

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 48
    • View Profile
Re: Playing an Enviroment animation
« Reply #3 on: May 08, 2004, 12:16:45 PM »

Ho! THANKS YOU!  ;D
Logged
 

Page created in 0.054 seconds with 23 queries.