Advertisement
Yasden

[Danmakufu] Justin's Dialogue Script

Dec 16th, 2014
280
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.97 KB | None | 0 0
  1. let dialogue = ObjText_Create();  // Main Dialogue Text
  2. let enmName = ObjText_Create();   // Enemy Name
  3. let PIMG =  ObjPrim_Create(OBJ_SPRITE_2D); //Player Image Object
  4. let box = ObjPrim_Create(OBJ_SPRITE_2D);//The transparent box that appears under the text in TH1-12
  5.  
  6.  
  7.  
  8. ObjPrim_SetTexture(box, GetCurrentScriptDirectory~"/img/Box.png"); //same box
  9. ObjSprite2D_SetSourceRect(box, 0, 0, 344, 50); //Setting location for box texture to be taken from source image
  10. ObjSprite2D_SetDestCenter(box); //Set center
  11.  
  12.  
  13. ObjPrim_SetTexture(PIMG, GetCurrentScriptDirectory~"/img/Reimu.png"); //Set player image object texture
  14. ObjSprite2D_SetSourceRect(PIMG, 0, 0, 200, 400); //Setting rectangle to display texture
  15. ObjSprite2D_SetDestCenter(PIMG); //Setting center of player object
  16.  
  17.  
  18. let EIMG =  ObjPrim_Create(OBJ_SPRITE_2D);  // Enemy Image Object
  19.  
  20.     let FuncSrc;    //****Honestly not sure what this does until****
  21. local {
  22. FuncSrc = GetCurrentScriptDirectory;
  23. }  
  24.                     //**** Here****
  25.                    
  26.                    
  27. let cx = GetStgFrameWidth()/2;          // defining center of screen x
  28. let cy = GetStgFrameHeight()/2;         // ditto y
  29.            
  30.            
  31.  
  32. /*
  33. Alrighty
  34. Directions for using this fucnction:
  35. Arguments are as follows: Who starts talking first, Path to Enemy Image, "Name of Enemy", The Line on which music starts, the text at the very beginning.
  36. */
  37. function DialogueStarter(Starting, EnemyImg, SrcX, SrcY, EnemyName, MusicStartLine, StartingText){ // 0 = Player Start, 1 = Enemy Start.
  38. SetForbidPlayerShot(true); //Don't want no bombs being used during MY script
  39. SetForbidPlayerSpell(true);
  40.     if(Starting == 0) { ObjText_SetFontColorTop(dialogue, 255, 10, 10); ObjText_SetFontColorBottom(dialogue, 255, 255, 255); } //setting color of text object to reflect player talking
  41.     if(Starting == 1) { ObjText_SetFontColorTop(dialogue, 0, 0, 255); ObjText_SetFontColorBottom(dialogue, 0, 0, 0); } //setting color of text object to reflect enemy talking
  42.  
  43.     ObjRender_SetPosition(PIMG, cx - 120, cy + 80, 1); //Setting position of player image Object
  44.     ObjRender_SetScaleXYZ(PIMG, 0.5, 0.75, 1);
  45.    
  46.    
  47.     ObjPrim_SetTexture(EIMG, EnemyImg);//Set enemy texture
  48.     ObjSprite2D_SetSourceRect(EIMG, 0, 0, SrcX, SrcY); //Set source from which texture will be displayed
  49.     ObjSprite2D_SetDestCenter(EIMG); //Set center
  50.     ObjRender_SetPosition(EIMG, cx + 120, cy + 80, 1); //Set position
  51.     ObjRender_SetScaleXYZ(EIMG, 0.5, 0.75, 1); //Scale
  52.    
  53.     ObjRender_SetPosition(enmName, GetStgFrameWidth - 100, GetStgFrameHeight - 100, 9999); //Text object w/ enemy name (Not top left like the boss, a little cutin with name + title)
  54.        
  55.        
  56.             ObjText_SetText(dialogue, StartingText); //Set the text of the dialogue to the argument StartingText
  57.             ObjRender_SetPosition(dialogue, cx - 60, GetStgFrameHeight()- 100, 1); //Set the position of the dialogue text inside the box
  58.             /*
  59.             POTENTIAL PROBLEM ABOVE- Is Z = 1 the highest point on the screen or the lowest?
  60.             */
  61.             ObjText_SetFontSize(dialogue, 14); //Setting font size
  62.    
  63.    
  64.         ObjRender_SetPosition(box,cx, GetStgFrameHeight - 75, 99);
  65.  }
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72. function ChangeText(speak, WORDS) {  //This handles the changing of text in the main dialogue box.
  73.     if(speak == 0) {  //If player is speaking first
  74.     ObjRender_SetColor(EIMG, 0, 0 ,0); //Set enemy image to transparent
  75.     ObjRender_SetBlendType(EIMG, BLEND_ALPHA); //Same
  76.     ObjRender_SetAlpha(EIMG, 100);//Same
  77.    
  78.     ObjRender_SetAlpha(PIMG, 255); //Make player opaque
  79.    
  80.     ObjText_SetFontColorTop(dialogue, 255, 0, 0); //Set color of text
  81.     ObjText_SetFontColorBottom(dialogue, 255, 255, 255);  //Yep
  82.     }
  83.    
  84.    
  85.     if(speak == 1) {  //If enemy is speaking first
  86.     ObjRender_SetColor(PIMG, 0, 0 ,0);      //Setting player image to transparent
  87.     ObjRender_SetBlendType(PIMG, BLEND_ALPHA); //Same
  88.     ObjRender_SetAlpha(PIMG, 100);  //Same
  89.    
  90.     ObjRender_SetAlpha(EIMG, 255);//Make enemy opaque
  91.    
  92.         ObjText_SetFontColorTop(dialogue, 0, 255, 0); //Setting color of text
  93.     ObjText_SetFontColorBottom(dialogue, 0, 0, 0); //Yep
  94.    
  95.  
  96.     }
  97.     ObjText_SetText(dialogue, WORDS); //Set text.
  98. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement