• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

GameMaker Changing a Camera's Placement in Overworld Map

PlayerOne

Member
Self-explanatory as far as titles goes. The setup so far is that I have a ds_list of areas the player can go to, but more areas will be added as the player progresses. The following area names in that ds_list is drawn within the menu interface and going to said areas isn't an issue.

The problem comes when trying to place the camera in the overworld map when a selected area name is highlighted within the UI. The overworld map itself has pre-drawn areas of each location and I'm trying to relocate the camera every time an area in the menu is highlighted to that pre-drawn area to show where the player is going.

“City” = Camera x and y in overworld map
“Park” = Camera x and y in overworld map

Given the current setup I'm not sure how to implement this idea given that I use 2 object variables to get the menu cursor's position within the UI.


The code so far:

Code:
CREATE:

amount=8; // <<< Amount of menu options displayed on screen
cursor=0; // <<< Cursor position when moving
cursor_pos=0; // <<< Continued movement of cursor when pressing down
cursor_id=0; // the total cursor movement (cursor + cursor_pos) to give the proper id
page_down=0; // <<< Used in the scroll effect seen on screen
_max=ds_list_size(global.map); // <<< Max amount of options in the total menu


for (var i=0; i<_max; i++)
{

dest[i,0]=room_get_name(i)
dest[i,1]=i
   
}
Code:
STEP:

cursor_id=cursor+cursor_pos;

if (keyboard_check_pressed(vk_up) && cursor_id!=0) // <<< if yp is pressed and cursor_id doesn't equal zero.
   {
       
       if cursor!=0{cursor--;}   // <<< Movement of cursor within the space of 0 and amount (12)
       else{page_down--; cursor_pos--}; // <<< Movement of cursor when movement is at play, uses a scroll effect while still adding to cursor_id.
       
   }

   if (keyboard_check_pressed(vk_down) && cursor_id!=(_max-1)) // If pressing down and cursor_id doesn't equal the maximum.
   {
       
       if cursor<amount-1{cursor++;}   // <<< If cursor is within movement range (0-11) then it will move
       else{page_down++; cursor_pos++}; // <<< If cursor is greater than 11 the scroll effect is seen and cursor_pos adds to cursor_id total.
           
   } // <<< Page down
   
   
   
if keyboard_check_pressed(vk_space)
{
   
   switch(dest[cursor_id,1])
   {
       
   case 4:
   room_goto(dest[cursor_id,1])
   break;
            
   }
   
}
Code:
DRAW GUI:

//Draw Menu
var i=0;
var ii=0
var pos_x = (128);
var pos_y = (128);
var _space = 32;

draw_rectangle_width(128-25,128-25,420,((_space*1.6)*amount),4)
draw_sprite_ext(ePixel,0,pos_x-15,pos_y+(cursor*_space-3),256+32,32,0,c_ltgray,1)

draw_set_color(c_white)

               for(i=page_down;i<(amount+page_down); i++)
               {
                               
                               if (cursor_id!=_max)
                               {
                               draw_text(pos_x, pos_y + ((ii)*_space),string(dest[i,0]));
                               ii++;
                               }
                           
                           
               }
Any suggestions?
 
Top