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: i don't understand footstep for 2d actor  (Read 3487 times)

0 Members and 1 Guest are viewing this topic.

dreamfighter

  • Supporter
  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 28
    • View Profile
i don't understand footstep for 2d actor
« on: May 10, 2008, 02:41:05 PM »

hello everybody

since yesterday i read all the post about footsteps and really i don't understand. i saw the 3d demo trinity but i use a 2d sprite actor for my game and not a 3d actor.
so i understood that i need to copy this script

on "footstep"
{
 // get a region the actor is standing in
 var Reg = Scene.GetRegionAt(this.X, this.Y);
 if (Reg!=null)
 {
   // play a sound depenging on a surface
   // "xSurface" is a custom property we defined in SceneEdit
   switch(Reg.xSurface)
   {
     case "grass":
       this.PlaySound("footsteps\grass.ogg");
     break;
 
     case "wood":
       this.PlaySound("footsteps\wood.ogg");
     break;
 
     // add more sounds here...
   }
 }


in myactor.script




but i don't understand about this part:

 ANIMATION
  {
    NAME="walk"
    LOOPING=TRUE
   
                EVENT
                {
              FRAME = 2
                 NAME = "footstep"
                }
      EVENT
      {
         FRAME = 20
         NAME = "footstep"
      }   

  }
i don't know where i need to put this part in my actor definition file.




my original actor definition file is:

; $EDITOR_PROJECT_ROOT_DIR$ ..\..\..\

ACTOR
{
  NAME = "Nolan"
  CAPTION=""
  SCALABLE = TRUE
  INTERACTIVE = FALSE
  X = 400
  Y = 460
  SCRIPT="actors\Nolan\Nolan.script"

  FONT = "fonts\outline_red.font"


  ANIMATION
  {
    NAME       = "idle"
   
    LEFT       = "actors\Nolan\ll\stand.sprite"
    RIGHT      = "actors\Nolan\rr\stand.sprite"
    UP         = "actors\Nolan\uu\stand.sprite"
    DOWN       = "actors\Nolan\dd\stand.sprite"

    UP_LEFT    = "actors\Nolan\ul\stand.sprite"
    UP_RIGHT   = "actors\Nolan\ur\stand.sprite"
    DOWN_LEFT  = "actors\Nolan\dl\stand.sprite"
    DOWN_RIGHT = "actors\Nolan\dr\stand.sprite"
  } 

  ANIMATION
  {
    NAME       = "walk"
   LEFT       = "actors\Nolan\ll\walk.sprite"
    RIGHT      = "actors\Nolan\rr\walk.sprite"
    UP         = "actors\Nolan\uu\walk.sprite"
    DOWN       = "actors\Nolan\dd\walk.sprite"

    UP_LEFT    = "actors\Nolan\ul\walk.sprite"
    UP_RIGHT   = "actors\Nolan\ur\walk.sprite"
    DOWN_LEFT  = "actors\Nolan\dl\walk.sprite"
    DOWN_RIGHT = "actors\Nolan\dr\walk.sprite"
     }


  ANIMATION
  {
    NAME       = "talk"
   
    LEFT       = "actors\Nolan\ll\talk.sprite"
    RIGHT      = "actors\Nolan\rr\talk.sprite"
    UP         = "actors\Nolan\uu\talk.sprite"
    DOWN       = "actors\Nolan\dd\talk.sprite"

    UP_LEFT    = "actors\Nolan\ul\talk.sprite"
    UP_RIGHT   = "actors\Nolan\ur\talk.sprite"
    DOWN_LEFT  = "actors\Nolan\dl\talk.sprite"
    DOWN_RIGHT = "actors\Nolan\dr\talk.sprite"
  }

  ANIMATION
  {
    NAME       = "turnleft"
   
    LEFT       = "actors\Nolan\ll\turn.sprite"
    RIGHT      = "actors\Nolan\rr\turn.sprite"
    UP         = "actors\Nolan\uu\turn.sprite"
    DOWN       = "actors\Nolan\dd\turn.sprite"

    UP_LEFT    = "actors\Nolan\ul\turn.sprite"
    UP_RIGHT   = "actors\Nolan\ur\turn.sprite"
    DOWN_LEFT  = "actors\Nolan\dl\turn.sprite"
    DOWN_RIGHT = "actors\Nolan\dr\turn.sprite"
  }
 
  ANIMATION
  {
    NAME       = "turnright"
   
    LEFT       = "actors\Nolan\ll\turn.sprite"
    RIGHT      = "actors\Nolan\rr\turn.sprite"
    UP         = "actors\Nolan\uu\turn.sprite"
    DOWN       = "actors\Nolan\dd\turn.sprite"

    UP_LEFT    = "actors\Nolan\ul\turn.sprite"
    UP_RIGHT   = "actors\Nolan\ur\turn.sprite"
    DOWN_LEFT  = "actors\Nolan\dl\turn.sprite"
    DOWN_RIGHT = "actors\Nolan\dr\turn.sprite"
  } 
}


so can you help me or send me an example with 2d actor sprite

thank you very much for helps

« Last Edit: May 10, 2008, 02:46:14 PM by dreamfighter »
Logged

Net

  • Gripped Software Programmer
  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 48
    • View Profile
    • Čurina
Re: i don't understand footstep for 2d actor
« Reply #1 on: May 10, 2008, 03:11:50 PM »

Yes, you have to copy this

Code: [Select]
on "footstep"
{
 // get a region the actor is standing in
 var Reg = Scene.GetRegionAt(this.X, this.Y);
 if (Reg!=null)
 {
   // play a sound depenging on a surface
   // "xSurface" is a custom property we defined in SceneEdit
   switch(Reg.xSurface)
   {
     case "grass":
       this.PlaySound("footsteps\grass.ogg");
     break;
 
     case "wood":
       this.PlaySound("footsteps\wood.ogg");
     break;
 
     // add more sounds here...
   }
 }

to your actor.script.

Then you must define "footstep" event in SpriteEditor to your actor walk sprite



and also you must have defined some areas in you scene with "xSurface" property

Logged

dreamfighter

  • Supporter
  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 28
    • View Profile
Re: i don't understand footstep for 2d actor
« Reply #2 on: May 10, 2008, 07:01:43 PM »

really thank you very much net, for the explain  it's very nice of your part to post screen. i's more easy for me i'm newbies.

i followed step by step your explain, but i think i forget something, i haven't steps sound in my scene.
i verify and the steps sounds are in my sounds folder.

how can i do

Thanks
« Last Edit: May 10, 2008, 07:40:35 PM by dreamfighter »
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: i don't understand footstep for 2d actor
« Reply #3 on: May 11, 2008, 08:33:07 AM »

It's hard for *us* to tell what you forgot about :) This thread contains all the info you need, try to double-check all the steps.
Also, it's summarized in this wiki article.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Net

  • Gripped Software Programmer
  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 48
    • View Profile
    • Čurina
Re: i don't understand footstep for 2d actor
« Reply #4 on: May 11, 2008, 10:05:14 AM »

Is WME showing some error?

Try to Check syntax of your actor.script.

If you have exactly footstep method you've post, there is a mistake.
The method is not ended correctly. At the end is missing }.
Logged

dreamfighter

  • Supporter
  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 28
    • View Profile
Re: i don't understand footstep for 2d actor
« Reply #5 on: May 11, 2008, 02:50:43 PM »

Thank you menmonic i checked a new time step by step and my error was the } at the end of my script like said net. thank you net for this details.
it 's very cool that working thank you both


About this engine, my opinion is wintermute is the very best engine that i found on the web, really and it's free.
Thank you for that mnemonic.
Logged
 

Page created in 0.034 seconds with 19 queries.