Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - slavec

#1
You made my day!
Now I can make some games.
Thanks!

:=
#2
I have the same Idleview problem.
When I use "KeyboardMovement.SetIdleView(4, 0);"  in global's game_start(or repeatedly_execute), the character only plays the first two frames of the idle, then loops that over and over again.
The same if I write (4,40). It waits 40 frames, and then show first 2 idleframes and loops quickly.
I have tried with a new clean AGS project also, but the same will happen.
Otherwise the module is great!
#3
Thanks for the replys.
I am a beginner with AGS and scriping, so I don't really know how to manage that.
Can I get some direction on what code to use?
#4
Just to make it clear:
What I want is for the character to animate the idle when standing still. Loop without a delay.
Now with the module, the idle is always stuck on the first frame. And when I disable the module, the animation works as it should.
Otherwise the module is super for my project.

Here is the whole Bernie-code:

Code: ags

// Main script for module '8 Direction Movement'

//required values

int xm;
int ym;
int xspeed=38;
int yspeed=38;
int xwidth=5;
int ywidth=5;
int slide=8;
int a;
int c;
int dir;
int diagslowdown=1;
int walkanispeed=1;
int thrust;
int walkingani=2;
int disablemove;
int nodirset;
int eightdir;

static function EightDir::SetSpeed(int x, int y) {
  xspeed = x;
  yspeed = y;
}

static function EightDir::SetSize(int x, int y) {
  xwidth = x;
  ywidth = y;
}

static function EightDir::WalkViewSpeed(int speed) {
  walkanispeed = speed;
}  

static function EightDir::SetWalkView(int view) {
  walkingani = view;
}  

static function EightDir::SetSlide(int value) {
  slide = value;
}  

static function EightDir::Disable(bool value) {
  disablemove = value;
}  

static function EightDir::NoDirSet(bool value) {
  nodirset = value;
}  

static function EightDir::DiagSlow(bool value) {
  diagslowdown = value;
}  

static function EightDir::Thrust(int x, int y) {
  xm=x;
  ym=y;  
  thrust=1;
}  

static function EightDir::EightLoopsMode(bool value) {
  eightdir = value;
}

static function EightDir::IsMoving() {
  if ((xm!=0)||(ym!=0)) {return 1;}
  if ((xm==0)&&(ym==0)) {return 0;}
}

static function EightDir::IsThrusting() {
  return thrust;
}


#sectionstart repeatedly_execute  // DO NOT EDIT OR REMOVE THIS LINE
function repeatedly_execute() {
  // put anything you want to happen every game cycle here

int up=0;
int down=0;
int left=0;
int right=0;

  if ((IsInterfaceEnabled()==1)&&(IsGamePaused()==0)) {

    if (IsKeyPressed(68)==1) {right=1;}
    if (IsKeyPressed(65)==1) {left=1;}
    if (IsKeyPressed(83)==1) {down=1;}
    if (IsKeyPressed(87)==1) {up=1;}
  }


  if ((IsInterfaceEnabled()==0)||(disablemove==1)) {xm=0;ym=0;}

  if ((player.Moving==0)&&(IsInterfaceEnabled()==1)&&(IsGamePaused()==0)&&(disablemove==0)) {

    int b=0;

    if ((xm==0) && (ym==0)) {thrust=0;}


    //moving values

      while (b<slide){

        if (thrust==0){

          if ((right==1) && (xm < xspeed))  {xm=xm+1;}   //right
          if ((left==1) && (xm > xspeed*(-1)))  {xm=xm-1;}   //left

          if ((down==1) && (ym < yspeed))  {ym=ym+1;}   //down
          if ((up==1) && (ym > yspeed*(-1)))  {ym=ym-1;}   //up

          if ((left==0) && (right==0) && (xm>0))  {xm=xm-1;}
          if ((left==0) && (right==0) && (xm<0))  {xm=xm+1;}

          if ((up==0) && (down==0) && (ym>0))  {ym=ym-1;}
          if ((up==0) && (down==0) && (ym<0))  {ym=ym+1;} 
        
        }  

      if (thrust==1) {
        if (xm > 0){xm=xm-1;}
        if (xm < 0){xm=xm+1;}
        if (ym > 0){ym=ym-1;}
        if (ym < 0){ym=ym+1;}
      }

    //slowdown

    if (thrust==0){
      if (xm > xspeed){xm=xm-1;}
      if (xm < xspeed*(-1)){xm=xm+1;}
      if (ym > yspeed){ym=ym-1;}
      if (ym < yspeed*(-1)){ym=ym+1;}
    }

  b=b+1;
  }

  //diagslowdown

  if (diagslowdown==1){

    int slow=0;
    while (slow <slide+1){

     if ((right==1)&&(down==1)) {
       if (xm>(xspeed*70)/100) {xm=(xm*70)/100;}
       if (ym>(yspeed*70)/100) {ym=(ym*70)/100;}
     }

     if ((left==1)&&(down==1)) {
       if (xm<((xspeed*70)/100)*(-1)) {xm=((xspeed*70)/100)*(-1);}
       if (ym>(yspeed*70)/100) {ym=(ym*70)/100;}
     }

     if ((left==1)&&(up==1)) {
       if (xm<((xspeed*70)/100)*(-1)) {xm=((xspeed*70)/100)*(-1);}
       if (ym<((yspeed*70)/100)*(-1)) {ym=((yspeed*70)/100)*(-1);}
     }

     if ((right==1)&&(up==1)) {
       if (xm>(xspeed*70)/100) {xm=(xm*70)/100;}
       if (ym<((yspeed*70)/100)*(-1)) {ym=((yspeed*70)/100)*(-1);}
     }
   slow=slow+1;
   }
  }

  //right

  int loop=0;

  if (xm>0){

    while (loop <xm) {
      a=a+1;
      if (a>10) {a=0;}
      if (a==5){
        player.x = player.x +xwidth;
        if (GetWalkableAreaAt(player.x - GetViewportX(),player.y - GetViewportY())>0) {player.x=player.x +1;}
        player.x = player.x -xwidth;
      }
    loop=loop+1;
    }
  }


  //left

  loop=0;

  if (xm<0){

    while (loop > xm) {
      a=a+1;
      if (a>10) {a=0;}
      if (a==5){
        player.x = player.x -xwidth;
        if (GetWalkableAreaAt(player.x - GetViewportX(),player.y - GetViewportY())>0) {player.x=player.x -1;}
        player.x = player.x +xwidth;
      }
    loop=loop-1;
   }
  }


  //down

  loop=0;

  if (ym>0){

    while (loop <ym) {
      c=c+1;
      if (c>10) {c=0;}
      if (c==5){
        player.y = player.y +ywidth;
        if (GetWalkableAreaAt(player.x - GetViewportX(),player.y - GetViewportY())>0) {player.y=player.y +1;}
        player.y = player.y -ywidth;
      }
    loop=loop+1;
    }
  }


  //up

  loop=0;

  if (ym<0){
    while (loop >ym) {
      c=c+1;
      if (c>10) {c=0;}
      if (c==5){
        player.y = player.y -ywidth;
        if (GetWalkableAreaAt(player.x - GetViewportX(),player.y - GetViewportY())>0) {player.y=player.y -1;}
        player.y = player.y +ywidth;
      }
    loop=loop-1;
    }
  }


  //outpush

  player.x = player.x -xwidth;
    if (GetWalkableAreaAt(player.x - GetViewportX(),player.y - GetViewportY())==0) {player.x=player.x +1;}
  player.x = player.x +xwidth;

  player.x = player.x +xwidth;
    if (GetWalkableAreaAt(player.x - GetViewportX(),player.y - GetViewportY())==0) {player.x=player.x -1;}
  player.x = player.x -xwidth;

  player.y = player.y -ywidth;
    if (GetWalkableAreaAt(player.x - GetViewportX(),player.y - GetViewportY())==0) {player.y=player.y +1;}
  player.y = player.y +ywidth;

  player.y = player.y +ywidth;
    if (GetWalkableAreaAt(player.x - GetViewportX(),player.y - GetViewportY())==0) {player.y=player.y -1;}
  player.y = player.y -ywidth;

  //outpush #2

  player.y = player.y -ywidth;

  player.x = player.x -xwidth;
    if (GetWalkableAreaAt(player.x - GetViewportX(),player.y - GetViewportY())==0) {player.x=player.x +1;}
  player.x = player.x +xwidth;

  player.y = player.y +ywidth;
  player.y = player.y +ywidth;

  player.x = player.x -xwidth;
    if (GetWalkableAreaAt(player.x - GetViewportX(),player.y - GetViewportY())==0) {player.x=player.x +1;}
  player.x = player.x +xwidth;

  player.y = player.y -ywidth;



  player.y = player.y -ywidth;

  player.x = player.x +xwidth;
    if (GetWalkableAreaAt(player.x - GetViewportX(),player.y - GetViewportY())==0) {player.x=player.x -1;}
  player.x = player.x -xwidth;

  player.y = player.y +ywidth;

  player.y = player.y +ywidth;

  player.x = player.x +xwidth;
    if (GetWalkableAreaAt(player.x - GetViewportX(),player.y - GetViewportY())==0) {player.x=player.x -1;}
  player.x = player.x -xwidth;

  player.y = player.y -ywidth;



  player.x = player.x +xwidth;

  player.y = player.y -ywidth;
  if (GetWalkableAreaAt(player.x - GetViewportX(),player.y - GetViewportY())==0) {player.y=player.y +1;}
  player.y = player.y +ywidth;

  player.x = player.x -xwidth;



  player.x = player.x -xwidth;

  player.y = player.y -ywidth;
    if (GetWalkableAreaAt(player.x - GetViewportX(),player.y - GetViewportY())==0) {player.y=player.y +1;}
  player.y = player.y +ywidth;

  player.x = player.x +xwidth;



  player.x = player.x -xwidth;

  player.y = player.y +ywidth;
    if (GetWalkableAreaAt(player.x - GetViewportX(),player.y - GetViewportY())==0) {player.y=player.y -1;}
  player.y = player.y -ywidth;

  player.x = player.x +xwidth;
 
 
  
  player.x = player.x +xwidth;

  player.y = player.y +ywidth;
    if (GetWalkableAreaAt(player.x - GetViewportX(),player.y - GetViewportY())==0) {player.y=player.y -1;}
  player.y = player.y -ywidth;

  player.x = player.x -xwidth;

 
  //animations

  if (thrust==0){

    if (walkingani>0){
      if ((xm!=0)||(ym!=0)) {if (player.View!=walkingani) {player.LockView(walkingani);
      player.Animate(0,walkanispeed, eRepeat, eNoBlock, eForwards);}}

      if ((xm==0)&&(ym==0)) {player.UnlockView();}
    }
  }


  //set direction

  if (eightdir==0){

    if ((left==1)||(right==1)||(up==1)||(down==1)){

      if (thrust==0){

        if (ym>0) {if ((left==0)&&(right==0))  {dir=0;}}
        if (xm<0) {if ((up==0)&&(down==0))  {dir=1;}}
        if (xm>0) {if ((up==0)&&(down==0))  {dir=2;}}
        if (ym<0) {if ((left==0)&&(right==0))  {dir=3;}}

        if ((ym>0) && (player.Loop==3))  {dir=0;}
        if ((ym<0) && (player.Loop==0))  {dir=3;}
        if ((xm>0) && (player.Loop==1))  {dir=2;}
        if ((xm<0) && (player.Loop==2))  {dir=1;}
      }
    }
  }


  if (eightdir==1){

    if ((left==1)||(right==1)||(up==1)||(down==1)){

      if (thrust==0) {
    
        if ((xm>0)&&(ym==0)) {dir=2;}
        if ((xm<0)&&(ym==0)) {dir=1;}
        if ((xm==0)&&(ym>0)) {dir=0;}
        if ((xm==0)&&(ym<0)) {dir=3;}

        if ((xm>0)&&(ym>0)) {dir=4;}
        if ((xm<0)&&(ym>0)) {dir=6;}
        if ((xm<0)&&(ym<0)) {dir=7;}
        if ((xm>0)&&(ym<0)) {dir=5;}
      }
    }
  }


  if ((player.Moving==0)&&(nodirset==0)) {player.Loop=dir;}
  }


  if (player.Moving==1) {dir=player.Loop;}

  if (nodirset>0) {dir=player.Loop;}

  if (IsInterfaceEnabled()==0) {dir=player.Loop;}

}
#sectionend repeatedly_execute  // DO NOT EDIT OR REMOVE THIS LINE

#5
Hey!

I have a problem with the idle animation, when using Bernie's 8 Direction Movement module.
The idle freezes on the first frame.
I have tried:   cEgo.SetIdleView(4, 0);  ,but with no luck.

I think this is the code that's freezing it:
Code: ags

//animations

  if (thrust==0){

    if (walkingani>0){
      if ((xm!=0)||(ym!=0)) {if (player.View!=walkingani) {player.LockView(walkingani);
      player.Animate(0,walkanispeed, eRepeat, eNoBlock, eForwards);}}

      if ((xm==0)&&(ym==0)) {player.UnlockView();}
    }
  }

SMF spam blocked by CleanTalk