Results 1 to 2 of 2

Thread: need a bit help! ;)

                  
   
  1. #1

    Default need a bit help! ;)

    Hi,
    i just started to learn fenix and im working a bit on a Zelda like game..
    i do this with help of a tutorial.

    i use this code to move the charakter
    Code:
    if (key(_right) and not key(_up) and not key(_down))
    x=x+2; angle=0;
    if (graph<=2 or graph>=7) graph=2; end;
    graph++; flags=0; angle=0;
    end
    now the problem is, that if you dont press the button anymore, the last sprite which was drawn stays on the screen and that looks sometimes a bit strange..
    so i want to add a bit more code to this..
    graph = 1 should be drawn after moving...
    how i can do this?

  2. #2
    DCEmu Newbie
    Join Date
    Jan 2005
    Age
    40
    Posts
    67
    Rep Power
    0

    Default Re: need a bit help! ;)

    Well, I don't know perfectly what are you asking, because the code you paste is very abstract... but I've made something that can help you
    Code:
    program zelda_clone;
    Begin
     Set_title("Zelda Clone");
     Full_screen = FALSE;
     Graph_mode = mode_16bits;
     Set_mode (m640x480);
     load_fpg("myfpg.fpg");
     chara();
    end
    
    PROCESS chara()
    // graph=1 when character is standing, graph from 2 to 4 when is walking
    // graphs originally drawn with character head looking up
    
    PRIVATE walking;
    
    BEGIN
    x=320;
    y=240;
    graph=1;
     LOOP
     IF (key(_right)) 
      x=x+2; 
      angle=270000;
      walking=1;
     END
     IF (key(_left)) 
      x=x-2; 
      angle=90000;
      walking=1; 
     END
     IF (key(_up)) 
      y=y-2; 
      angle=0;
      walking=1;
     END
     IF (key(_down)) 
      y=y+2; 
      angle=180000;
      walking=1;
     END
     IF (NOT (key(_right)) AND NOT (key(_up)) AND NOT (key(_down)) AND NOT (key(_left)))
      walking=0;
     END
     If (walking==1)
      graph=graph+1;
     END
     IF (walking==1 AND graph==5)
      graph=2;
     END
     IF (walking==0)
      graph=1;
     END
     IF (key(_esc))
      exit("",0);
     END
     frame;
     END
    END
    Hope this can help, I think that there is another easiest way to make this, but I'm asleep (I retourned from vacation today, have to return early...)

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •