Advertisement
Guest User

TemplateStage.chai

a guest
Oct 31st, 2014
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.21 KB | None | 0 0
  1.  
  2. def loadGameElements()
  3. {
  4.     var bg;
  5.    
  6.     bg := new_GameElement(0,30);
  7.     var anim := new_Animation("normal", 1,1,1);
  8.     anim.addFrame("Images/mainstage.png");
  9.     bg.addAnimation(anim);
  10.     bg.changeAnimation("normal", FORWARD);
  11.     this.addElement(bg);
  12.    
  13.     bg := new_GameElement(0,-70);
  14.     bg.addAnimation(new_Animation("normal",1,"Images/plat_middle.png"));
  15.     bg.changeAnimation("normal", FORWARD);
  16.     this.addElement(bg);
  17.    
  18.     bg := new_GameElement(-110, -2);
  19.     bg.addAnimation(new_Animation("normal",1,"Images/plat_side.png"));
  20.     bg.changeAnimation("normal", FORWARD);
  21.     this.addElement(bg);
  22.    
  23.     bg := new_GameElement(110, -2);
  24.     anim := new_Animation("normal",1,"Images/plat_side.png");
  25.     anim.mirror(true);
  26.     bg.addAnimation(anim);
  27.     bg.changeAnimation("normal", FORWARD);
  28.     this.addElement(bg);
  29. }
  30.  
  31. def loadPlatforms()
  32. {
  33.     var plat;
  34.    
  35.     plat := new_Platform(PLATFORMTYPE_NORMAL, 0,112);
  36.     plat.addAnimation(new_Animation("normal",1,"Images/main_plat.png"));
  37.     plat.changeAnimation("normal", FORWARD);
  38.     plat.setVisible(false);
  39.     this.addPlatform(plat);
  40.    
  41.     plat := new_Platform(PLATFORMTYPE_GOTHROUGH, -46, -74, 92, 10);
  42.     this.addPlatform(plat);
  43.    
  44.     plat := new_Platform(PLATFORMTYPE_GOTHROUGH, -154, -7, 90, 10);
  45.     this.addPlatform(plat);
  46.    
  47.     plat := new_Platform(PLATFORMTYPE_GOTHROUGH, 66, -7, 90, 10);
  48.     this.addPlatform(plat);
  49. }
  50.  
  51. def loadHangPoints()
  52. {
  53.     var hp;
  54.    
  55.     hp = new_HangPoint(LEFT,-212,68);
  56.     this.addHangPoint(hp);
  57.    
  58.     hp = new_HangPoint(RIGHT,204,68);
  59.     this.addHangPoint(hp);
  60. }
  61.  
  62. def constructor()
  63. {
  64.     this.setSpawnPoint(0, 0,0);
  65.     this.setSpawnPoint(1,  115, -70);
  66.     this.setSpawnPoint(2, -115, -70);
  67.     this.setSpawnPoint(3,   0,-135);
  68.     this.setSpawnPoint(4,   0, -35);
  69.    
  70.     this.bottomViewBorder = 276;
  71.     this.topViewBorder = -276;
  72.     this.leftViewBorder = -400;
  73.     this.rightViewBorder = 400;
  74.    
  75.     this.topBorder = -420;
  76.    
  77.     this.setItemBoundaries(-200, -225, 200, 60);
  78.    
  79.     loadGameElements();
  80.     loadPlatforms();
  81.     loadHangPoints();
  82.    
  83.     this.setBackground("Images/bg.jpg");
  84.     this.setBackgroundScale(1.45);
  85.     this.setBackgroundType(STAGE_BG_FIXED);
  86.    
  87.     //this.setWireframeColor(COLOR_BLUE);
  88.     //this.showWireframes(true);
  89.    
  90.     return this;
  91. }
  92.  
  93. def destructor()
  94. {
  95.     //
  96. }
  97.  
  98. def Draw(g, gameTime)
  99. {
  100.     base_Draw(g, gameTime);
  101. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement