Page 4 of 5

Re: Dune Saga RPG

PostPosted: Sun Jul 30, 2017 10:47 pm
by awesome101
Decided to watch Bahubali The Beginning and Bahubali The Conclusion again to refresh my memory. What amazing movies. I need to create sprites now

Re: Dune Saga RPG

PostPosted: Mon Jul 31, 2017 6:24 am
by Duhjoker
Have you had a chance to look at and test the popup function. I cant seem to get it to work. Do you mind taking a look? The update is in my github for t3. I would really appreciate it.

Re: Dune Saga RPG

PostPosted: Mon Jul 31, 2017 9:34 pm
by awesome101
Will look at now. No worries

Re: Dune Saga RPG

PostPosted: Mon Jul 31, 2017 10:02 pm
by awesome101
This shouldn't be working. You set the duration of the popup to "12 + duration" which may work on the gamebuino but since you are using teensy or esp32 which is way faster, the popup will be gone in the blink of an eye. Use millis() or some other way to track the time and display the popup. Also, I recommend you don't use FlashStringHelper. Just use const char * because the Teensy doesn't have the same architecture as the Arduino and the const char * will be placed in flash memory anyway.

Re: Dune Saga RPG

PostPosted: Mon Jul 31, 2017 10:17 pm
by awesome101
Try this:
Code: Select all
  void GrafxT3::popup(const __FlashStringHelper* text, uint8_t duration){

   popupText = text;

   popupTimeLeft = millis() + duration * 1000;

}



void GrafxT3::updatePopup(){

   if (millis() < popupTimeLeft){

      int yOffset = 0;

      setTextSize(1);

//      setColor(WHITE);

      fillRoundRect(0,GrafxT3_TFTHEIGHT-textsize+yOffset-3,320,textsize+3,3,WHITE);

//      setColor(BLACK);

      drawRoundRect(0,GrafxT3_TFTHEIGHT-textsize+yOffset-3,320,textsize+3,3,BLACK);

      setCursor( 4, GrafxT3_TFTHEIGHT-textsize+yOffset-1);

      print(popupText);

   }

}



Pass in 1 for the duration in popup() function

Re: Dune Saga RPG

PostPosted: Mon Jul 31, 2017 10:49 pm
by awesome101
Then call the updatePopup() function in the main loop.
Edit: Did it work?

Re: Dune Saga RPG

PostPosted: Mon Jul 31, 2017 11:30 pm
by Duhjoker
Sorry, Youll have to give me a minute please. Just got back from the dentist and i cant concentrate to work just yet. Ill also need to make a set color functiin but thats the easy part.

Re: Dune Saga RPG

PostPosted: Mon Jul 31, 2017 11:43 pm
by Duhjoker
Ok just checked and nothing yet.

Re: Dune Saga RPG

PostPosted: Mon Jul 31, 2017 11:46 pm
by awesome101
So its not working? Can you post your full code
your sketch

Re: Dune Saga RPG

PostPosted: Tue Aug 01, 2017 2:47 am
by Duhjoker
Sorry I passed out and just woke back up

Code: Select all

/*This is the Main function file for the GameR-Iot Multiple MCU Arduino driven
 * game system and DIY console. This is a demo game RPG set in the Dune Universe
 * created by Frank Herbert.
 */
#include <GrafxT3.h>
#include <SPIN.h>
#include "SPI.h"
#include <Bounce.h>
#include "Player.h"
#include "World.h"
#include "Monsters.h"
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
#define TFT_DC  9
#define TFT_CS 10
#define TFT_RST 7
#define TFT_SCK 13
#define TFT_MISO 12
#define TFT_MOSI 11
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
uint8_t use_fb = 1;
uint8_t use_clip_rect = 0;
uint8_t use_set_origin = 0;
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
GrafxT3 tft = GrafxT3(TFT_CS, TFT_DC, TFT_RST, TFT_MOSI, TFT_SCK, TFT_MISO, &SPIN);
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
 int player_x = 160;     //player position on screen x
 int player_y = 176;     //player position on screen y
 int player_direction = 2;
 int x=-0,y=0;
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Camera offset
int cameraX = -544;  /////starting position X 0f camera on tilemap
int cameraY = -1344;  /////starting position Y of camera on tilemap

// Camera speed in pixels per update
int cameraXSpeed = 3;
int cameraYSpeed = 3;

// Camera offset boundaries
int cameraXMin = -1376;   /////// -320 0f total tilemap pixels left >>>>
int cameraXMax = 0;
int cameraYMin = -1440;   /////// -256 0f total tilemap pixels down VVVV
int cameraYMax = 0;

// Player offset boundaries
int playerXMin = 80;
int playerXMax = 240;
int playerYMin = 80;
int playerYMax = 160;

int animTransition;
int room = 1;
int co_ords = 1;
///////////////////////////////////////////////////////////////////////////////
///////////////////////////Pixel Color Includes////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
uint16_t palette[16];  // Should probably be 256, but I don't use many colors...
uint16_t pixel_data[2500];

//Extra integers for color palette
int a = 0xa; int b = 0xb; int c = 0xc;
int d = 0xd; int e = 0xe; int f = 0xf;

/////////////////////////////////////////////////////////////////////////////
/////////////////////////////Button assignments//////////////////////////////
/////////////////////////////////////////////////////////////////////////////
//////dpad + select buttons
const int buttonUp = 33; //up button
Bounce ButtonUp = Bounce(buttonUp, 10);  // 10 ms debounce
const int buttonDown = 38; //down_button
Bounce ButtonDown = Bounce(buttonDown, 10);  // 10 ms debounce
const int buttonLeft = 35; //left button
Bounce ButtonLeft = Bounce(buttonLeft, 10);  // 10 ms debounce
const int buttonRight = 17; //right button
Bounce ButtonRight = Bounce(buttonRight, 10);  // 10 ms debounce
const int buttonS = 21; //select button
Bounce ButtonS = Bounce(buttonS, 10);  // 10 ms debounce

//////action + start buttons
const int buttonX = 32; // X button up
Bounce ButtonX = Bounce(buttonX, 10);  // 10 ms debounce
const int buttonY = 26; // Y button left
Bounce ButtonY = Bounce(buttonY, 10);  // 10 ms debounce
const int buttonA = 21; // A button right
Bounce ButtonA = Bounce(buttonA, 10);  // 10 ms debounce
const int buttonB = 28; // B buttun down
Bounce ButtonB = Bounce(buttonB, 10);  // 10 ms debounce
const int buttonT = 4; // Start button
Bounce ButtonT = Bounce(buttonT, 10);  // 10 ms debounce

///////////////////////////////////////////////////////////////////////////////
///////////////////////////////Set-up//////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////

void setup() {
  while (!Serial && (millis() < 4000)) ;
  Serial.begin(115200);
  tft.begin();
  tft.setRotation(1);
  tft.fillScreen(BLACK);
  //tft.setFrameRate(60);
  tft.persistence = false;
   pinMode(buttonUp, INPUT_PULLUP);
   pinMode(buttonDown, INPUT_PULLUP);
   pinMode(buttonLeft, INPUT_PULLUP);
   pinMode(buttonRight, INPUT_PULLUP);
   pinMode(buttonS, INPUT_PULLUP);
   pinMode(buttonX, INPUT_PULLUP);
   pinMode(buttonY, INPUT_PULLUP);
   pinMode(buttonA, INPUT_PULLUP);
   pinMode(buttonB, INPUT_PULLUP);
   pinMode(buttonT, INPUT_PULLUP);
 
   tft.useFrameBuffer(use_fb);
     uint32_t start_time = millis();
 
}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////Loop////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
void loop(void) {

///////////////////////////////////////////////////////////////////////////////
////////////////////////////////camera controls////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Clamp cameraX
if(cameraX < cameraXMin)
{
  cameraX = cameraXMin;
}
else if(cameraX > cameraXMax)
{
   cameraX = cameraXMax;
}

// Clamp cameraY
if(cameraY < cameraYMin)
{
  cameraY = cameraYMin;
}
else if(cameraY > cameraYMax)
{
   cameraY = cameraYMax; 
}

// Check if player is beyond X boundary
if(player_x < playerXMin)
{
  cameraX += cameraXSpeed;
  if(cameraX > cameraXMin && cameraX < cameraXMax)
  {
    player_x = playerXMin;
  }
}
else if(player_x > playerXMax)
{
  cameraX -= cameraXSpeed;
  if(cameraX > cameraXMin && cameraX < cameraXMax)
  {
    player_x = playerXMax;
  }
}

// Check if player is beyond Y boundary
if(player_y < playerYMin)
{
  cameraY += cameraYSpeed;
  if(cameraY > cameraYMin && cameraY < cameraYMax)
  {
    player_y = playerYMin;
  }
}
else if(player_y > playerYMax)
{
  cameraY -= cameraYSpeed;
  if(cameraY > cameraYMin && cameraY < cameraYMax)
  {
    player_y = playerYMax;
  }
}
//////////////////////////////////////////////////////////////////////////////
///////////////////////////////Palette////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
 palette[0] = 0;
       palette[1] = BLACK;
             palette[2] = BLUE;
                   palette[3] = BROWN;
                         palette[4] = DARKGREEN;
                              palette[5] = GREY;
                                    palette[6] = PINK;
                                          palette[7] = RED;
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////                                               
                                           palette[8] = BEIGE;
                                     palette[9] = GREEN;
                               palette[a]= DARKGREY;
                         palette[b] = LIGHTGREY;
                   palette[c] = YELLOW;
             palette[d] = PURPLE;
       palette[e] = WHITE;
 palette[f] = ORANGE;
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////Tilemap/////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
     if(room == 1){
  tft.drawTilemap(cameraX, cameraY, duneworld, spritesheet, palette);}
else if(room == 2){
  tft.drawTilemap(cameraX, cameraY, dungeon1l1, spritesheet, palette);}
else if(room == 3){
  tft.drawTilemap(cameraX, cameraY, dungeon1l2, spritesheet, palette);}
else if(room == 4){
  tft.drawTilemap(cameraX = 0, cameraY = 0, dungeon1l3, spritesheet, palette);}
     if(room == 5){
  tft.drawTilemap(cameraX = 0, cameraY = 0, dungeon2l3, spritesheet, palette);}
     if(room == 6){
  tft.drawTilemap(cameraX = 0, cameraY = 0, dungeon2l2, spritesheet, palette);}
     if(room == 7){
  tft.drawTilemap(cameraX = 0, cameraY = 0, dungeon2l1, spritesheet, palette);}
     if(room == 8){
  tft.drawTilemap(cameraX = 0, cameraY = 0, seitch1v, spritesheet, palette);}
     if(room == 9){
  tft.drawTilemap(cameraX = 0, cameraY = 0, seitch1r1, spritesheet, palette);}
     if(room == 10){
  tft.drawTilemap(cameraX = 0, cameraY = 0, seitch1r2, spritesheet, palette);}
     if(room == 11){
  tft.drawTilemap(cameraX = 0, cameraY = 0, seitch1r3, spritesheet, palette);}
     if(room == 12){
  tft.drawTilemap(cameraX = 0, cameraY = 0, seitch1r4l1, spritesheet, palette);}
     if(room == 13){
  tft.drawTilemap(cameraX = 0, cameraY = 0, seitch1r4l2, spritesheet, palette);}
     if(room == 14){
  tft.drawTilemap(cameraX = 0, cameraY = 0, seitch1r5l1, spritesheet, palette);}
     if(room == 15){
  tft.drawTilemap(cameraX = 0, cameraY = 0, seitch1r5l2, spritesheet, palette);}
     if(room == 16){
  tft.drawTilemap(cameraX = 0, cameraY = 0, seitch1r6, spritesheet, palette);}
     if(room == 17){
  tft.drawTilemap(cameraX = 0, cameraY = 0, seitch2v, spritesheet, palette);}
    if(room == 18){
  tft.drawTilemap(cameraX = 0, cameraY = 0, seitch2r1, spritesheet, palette);}
    if(room == 19){
  tft.drawTilemap(cameraX = 0, cameraY = 0, seitch2r2, spritesheet, palette);}
    if(room == 20){
  tft.drawTilemap(cameraX = 0, cameraY = 0, seitch2r3, spritesheet, palette);}
    if(room == 21){
  tft.drawTilemap(cameraX = 0, cameraY = 0, seitch2r4, spritesheet, palette);}
///////////////////////////////////////////////////////////////////////////////
///////////////////////////Buttons/////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////// 
       if (ButtonUp.update());
               if (ButtonDown.update());
                       if (ButtonLeft.update());
                             if (ButtonRight.update());
                                       if (ButtonA.update());
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
                                       ButtonUp.rebounce(10);
                               ButtonDown.rebounce(10);
                       ButtonLeft.rebounce(10);
            ButtonRight.rebounce(10);
     ButtonA.rebounce(10);
///////////////////////////////////////////////////////////////////////////////
////////////////////////////Up/////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
 if (ButtonUp.fallingEdge()){
     tft.writeRectNBPP(player_x, player_y,16,16,4,paulrearw,palette);
     player_direction = 1;
     player_y -= 4;
     if(checkcolision())
     {
      player_y += 4;}
     }
     if(player_y <= 16){
        player_y = 16;}
//////////////////////////////////////////////////////////////////////////////
///////////////////////////////Down///////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
 if (ButtonDown.fallingEdge()){
   tft.writeRectNBPP(player_x, player_y,16,16,4,paulfrontw,palette);
   player_direction = 2;
   player_y += 4;
    if(checkcolision())
    {
    player_y -=4;}
    }
    if(player_y >= 224){
       player_y = 224;}
//////////////////////////////////////////////////////////////////////////////
//////////////////////////Left////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////
 if (ButtonLeft.fallingEdge()){
   tft.writeRectNBPP(player_x, player_y,16,16,4,paulleftw,palette);
   player_direction = 3;
   player_x -= 4;
   if(checkcolision())
   {
      player_x += 4;} 
   }
   if(player_x >= 304){
      player_x = 304;}
//////////////////////////////////////////////////////////////////////////////
////////////////////////////Right////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
if (ButtonRight.fallingEdge()){
  tft.writeRectNBPP(player_x, player_y,16,16,4,paulrightw,palette);
  player_direction = 4;
  player_x += 4;
  if(checkcolision())
  {
    player_x -= 4;}
  }
            if(player_x <= 16){
              player_x = 16;}
///////////////////////////////////////////////////////////////////////////////     
//////////////////////////////PLAYER DIRECTION/////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
if (player_direction == 1){
  tft.writeRectNBPP(player_x, player_y,16,16,4,paulrear,palette);
}
/////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////
else if (player_direction == 2){
   tft.writeRectNBPP(player_x, player_y,16,16,4,paulfront,palette);
}
/////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////
else if (player_direction == 3){
    tft.writeRectNBPP(player_x, player_y,16,16,4,paulleft,palette);
}
/////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////
else if (player_direction == 4){
     tft.writeRectNBPP(player_x, player_y,16,16,4,paulright,palette);
        }
        tft.updatePopup();
       tft.updateScreen();
}     
/////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////collision/////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////
bool checkcolision(void) // Transformed it into a function
{
  for(uint16_t i=0; i < tft.numcolision + 1; i++)
  {
    if(tft.collideRectRect(player_x, player_y,16,16,tft.solid[i].x,tft.solid[i].y,16,16))
    {
        if(tft.solid[i].spritecol == bedtop)return true;
   else if(tft.solid[i].spritecol == bedbot)return true;
   else if(tft.solid[i].spritecol == bones11)return true;
   else if(tft.solid[i].spritecol == bones12)return true;
   else if(tft.solid[i].spritecol == bones13)return true;
   else if(tft.solid[i].spritecol == bones21)return true;
   else if(tft.solid[i].spritecol == bones22)return true;
   else if(tft.solid[i].spritecol == bones23)return true;
   else if(tft.solid[i].spritecol == bookstop )return true;
   else if(tft.solid[i].spritecol == booksbot)return true;
   else if(tft.solid[i].spritecol == cabtop)return true;
   else if(tft.solid[i].spritecol == cabbot)return true;
   else if(tft.solid[i].spritecol == cactus)return true;
   else if(tft.solid[i].spritecol == chimneytop)return true;
   else if(tft.solid[i].spritecol == chimneybot)return true;
   else if(tft.solid[i].spritecol == coconut)return false;
   else if(tft.solid[i].spritecol == debris)return false;
   else if(tft.solid[i].spritecol == floort)return false;
   else if(tft.solid[i].spritecol == palmtl)return true;
   else if(tft.solid[i].spritecol == palmtr)return true;
   else if(tft.solid[i].spritecol == palmbl)return true;
   else if(tft.solid[i].spritecol == palmbr)return true;
   else if(tft.solid[i].spritecol == ptreetop)return true;
   else if(tft.solid[i].spritecol == ptreebot)return true;
   else if(tft.solid[i].spritecol == plant1)return false;
   else if(tft.solid[i].spritecol == plant2)return false;
   else if(tft.solid[i].spritecol == rocktopcap)return true;
   else if(tft.solid[i].spritecol == rockbotcap)return true;
   else if(tft.solid[i].spritecol == rockleftcap)return true;
   else if(tft.solid[i].spritecol == rockrightcap)return true;
   else if(tft.solid[i].spritecol == rockcornertl)return true;
   else if(tft.solid[i].spritecol == rockcornertr)return true;
   else if(tft.solid[i].spritecol == rockcornerbl)return true;
   else if(tft.solid[i].spritecol == rockcornerbr)return true;
   else if(tft.solid[i].spritecol == rockcornersharptl)return true;
   else if(tft.solid[i].spritecol == rockcornersharptr)return true;
   else if(tft.solid[i].spritecol == rockcornersharpbl)return true;
   else if(tft.solid[i].spritecol == rockcornersharpbr)return true;
   else if(tft.solid[i].spritecol == rockendl)return true;
   else if(tft.solid[i].spritecol == rockendr)return true;
   else if(tft.solid[i].spritecol == rockwalllc)return true;
   else if(tft.solid[i].spritecol == rockwallrc)return true;
   else if(tft.solid[i].spritecol == rockwall){tft.popup(F(" ""Rock"" "),1); return true;}
   else if(tft.solid[i].spritecol == sand)return false;
   else if(tft.solid[i].spritecol == skeleton)return false;
   else if(tft.solid[i].spritecol == stonewall)return false;
   else if(tft.solid[i].spritecol == tablel)return true;
   else if(tft.solid[i].spritecol == tabler)return true;
   else if(tft.solid[i].spritecol == tablesm)return true;
   else if(tft.solid[i].spritecol == water)return true;
   else if(tft.solid[i].spritecol == machinet)return true;
   else if(tft.solid[i].spritecol == machineb)return true;
   else if(tft.solid[i].spritecol == printerl)return true;
   else if(tft.solid[i].spritecol == printerr)return true;
   else if(tft.solid[i].spritecol == machine2t)return true;
   else if(tft.solid[i].spritecol == machine2b)return true;
   else if(tft.solid[i].spritecol == watergate)return true;
////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////Action Tiles/////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////
   else if((tft.solid[i].spritecol == cave1)&& room == 1){room = 2; playerYMax = 320; playerYMin = -16; player_x = 160; player_y = 320; cameraX = 0; cameraY = -400; cameraXMin = 0;}                   
   else if((tft.solid[i].spritecol == exit1)&& room == 2){room = 1; player_x = 160, player_y = 176; cameraX = -544; cameraY = -1280;}
   else if((tft.solid[i].spritecol == stairsl1)&& room == 2){room = 3; player_x = 32; player_y = 48;}
   else if((tft.solid[i].spritecol == stepsleft1)&& room == 3){room = 2; player_x = 272;}
   else if((tft.solid[i].spritecol == stairsl2)&& room == 3){room = 4;}
   else if((tft.solid[i].spritecol == stepsleft2)&& room == 4){room = 3;}
   else if((tft.solid[i].spritecol == exit2)&& room == 4){room = 1;}
   else if((tft.solid[i].spritecol == cave2)&& room == 1){room = 4;}
   else if((tft.solid[i].spritecol == cave3)&& room == 1){room = 5;}
   else if((tft.solid[i].spritecol == exit3)&& room == 5){room = 1;} 
   else if((tft.solid[i].spritecol == stepsleft3)&& room == 5){room = 6;}
   else if((tft.solid[i].spritecol == stairsl3)&& room == 6){room = 5;}
   else if((tft.solid[i].spritecol == stepsleft4)&& room == 6){room = 7;}
   else if((tft.solid[i].spritecol == stairsl4)&& room == 7){room = 6;}
   else if((tft.solid[i].spritecol == exit4)&& room == 7){room = 1;}
   else if((tft.solid[i].spritecol == cave4)&& room == 1){room = 7;}
/////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////
///////////seitch 1   
   else if((tft.solid[i].spritecol == seitch1)&& room == 1){room = 8;}
   else if((tft.solid[i].spritecol == exit5)&& room == 8){room = 1;}
   else if((tft.solid[i].spritecol == cave5)&& room == 8){room = 9;}
   else if((tft.solid[i].spritecol == exit6)&& room == 9){room = 8;} 
   else if((tft.solid[i].spritecol == cave6)&& room == 8){room = 10;}
   else if((tft.solid[i].spritecol == exit7)&& room == 10){room = 8;}
   else if((tft.solid[i].spritecol == cave7)&& room == 8){room = 11;}
   else if((tft.solid[i].spritecol == exit8)&& room == 11){room = 8;}
   else if((tft.solid[i].spritecol == stairsl5)&& room ==11){room = 8;}
   else if((tft.solid[i].spritecol == stepsleft5)&& room ==8){room = 11;}
   else if((tft.solid[i].spritecol == cave8)&& room ==8){room = 12;}
   else if((tft.solid[i].spritecol == exit9)&& room ==12){room = 8;}
   else if((tft.solid[i].spritecol == stairsl6)&& room ==12){room = 13;}
   else if((tft.solid[i].spritecol == stepsleft6)&& room ==13){room = 12;}
   else if((tft.solid[i].spritecol == exit10)&& room ==13){room = 8;}
   else if((tft.solid[i].spritecol == cave9)&& room ==8){room = 13;}
   else if((tft.solid[i].spritecol == cave10)&& room ==8){room = 14;}
   else if((tft.solid[i].spritecol == exit11)&& room ==14){room = 8;}
   else if((tft.solid[i].spritecol == stairsl7)&& room ==14){room = 15;}
   else if((tft.solid[i].spritecol == stepsleft7)&& room ==15){room = 14;}
   else if((tft.solid[i].spritecol == exit12)&& room ==15){room = 8;}
   else if((tft.solid[i].spritecol == cave11)&& room ==8){room = 15;}
   else if((tft.solid[i].spritecol == cave12)&& room ==8){room = 16;}
   else if((tft.solid[i].spritecol == exit13)&& room ==16){room = 8;}
//////////////////////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////////////////////
/////////////seitch 2
   else if((tft.solid[i].spritecol == seitch2)&& room ==1){room = 17;}
   else if((tft.solid[i].spritecol == exit14)&& room ==17){room = 1;}
   else if((tft.solid[i].spritecol == cave13)&& room ==17){room = 18;}
   else if((tft.solid[i].spritecol == exit15)&& room ==18){room = 17;}
   else if((tft.solid[i].spritecol == cave14)&& room ==17){room = 19;}
   else if((tft.solid[i].spritecol == exit16)&& room ==19){room = 17;}
   else if((tft.solid[i].spritecol == cave15)&& room ==17){room = 20;}
   else if((tft.solid[i].spritecol == exit17)&& room ==20){room = 17;}
   else if((tft.solid[i].spritecol == stairsl8)&& room ==20){room = 17;}
   else if((tft.solid[i].spritecol == stepsleft8)&& room ==17){room = 20;}
   else if((tft.solid[i].spritecol == cave16)&& room ==17){room = 21;}
   else if((tft.solid[i].spritecol == exit18)&& room ==21){room = 17;}
   else if((tft.solid[i].spritecol == stairsr1)&& room ==17){room = 21;}
   else if((tft.solid[i].spritecol == stepsright1)&& room ==21){room = 17;}
   else if(tft.solid[i].spritecol == register1)return true;
   else if(tft.solid[i].spritecol == register2)return true; 
       }
   }
   //tft.updatePopup();
   return false; // Return false if don't touch anything
  }


////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////