Character Movement

i was trying to figure out movement of my character in a game.

well i got him moving!

extremely slowly, but moving. and now i know how to do collision detection with all the other tiles in my game so it is a huge step but... he moves so painfully slow! Does anyone know how i can fix this?

please go ahead and test out the game as it is so far. be patient. like i said. painfully slow.
you can download the game here (Allegro 5 RPG.zip):
https://sites.google.com/site/temprpgquestion/go-here-for-the-program

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//Drawing the map looks like this
  
  if(Redraw && al_is_event_queue_empty(EventQueue) || ForceRedraw)
           {
                Redraw = false;
                ForceRedraw = false;
                
                for(int Drawx = 0; Drawx < MapX; Drawx++)
                {
                    for(int Drawy = 0; Drawy < MapY; Drawy++)
                    {
                         al_set_target_backbuffer(GameDisplay);
                         al_draw_bitmap_region(TileSheet, Map[Drawy][Drawx] * TileSize, 0, TileSize, 32, Drawx * TileSize,
                                               Drawy * TileSize, 0);
                    }
               }
               for(int Drawx = 0; Drawx < MapX; Drawx++)
               {
                    for(int Drawy = 0; Drawy < MapY; Drawy++)
                    {
                         al_convert_mask_to_alpha(PlayerTileSheet, al_map_rgb(255, 0, 255));
                         al_draw_bitmap_region(PlayerTileSheet, PlayerMap[Drawy][Drawx] * TileSize, 0, TileSize, 32, Drawx * TileSize,
                                               Drawy * TileSize, 0);
                    }
               }
          }
 
 
 //movement looks like this
 
 if(Event.type == ALLEGRO_EVENT_KEY_DOWN)
     {
          switch(Event.keyboard.keycode)
          {
               case ALLEGRO_KEY_UP:
                    Y2 = Y - 1;
                    
                    if(PlayerMap[Y2][X] == 5)
                    {
                         PlayerMap[Y][X] = 5;
                         Y--;
                         PlayerMap[Y][X] = 0;
                         ForceRedraw = true;
                    }
                    break;


thank you for the help in advance.
It doesn't let me download the game. It's saying that The requested URL was not found on this server.
huh. i will repost it then. You can try it again now.
Last edited on
Topic archived. No new replies allowed.