LoginLogin
Nintendo shutting down 3DS + Wii U online services, see our post

Fade in/out characters

Root / Programming Questions / [.]

PixelStudioCreated:
Hello everyone I have a decent starting cutscence in dev. And I was wondering if Its possible to fade in and out only characters using GPUTCHR, because when I do it it fades all the screen, Sprites is a solution but will be time consuming to organize them :p, if you find out let me know

I think you could use the color code and RGB() (Or Hexadecimal) to decrease the opacity of the character . I think this should work:
VAR TEXT$="Fading"
VAR IS_FADING=FALSE
VAR FADE_COUNTER=10

//GAME LOOP
WHILE TRUE
 GCLS
 input_
 showText
 VSYNC 1
WEND


DEF input_
 VAR B=BUTTON()

 //Fade the text if the user press A
 IF B==#A THEN IS_FADING=TRUE

END

DEF showText
  VAR COL=RGB(255,255,255)

  //If is fading then calculate the alfa value
  //You can replace 10 with a variable that contain the max number
  // of frame of the fading effect.

  IF IS_FADING THEN 
     COL=RGB(255*FADE_COUNTER/10,255,255,255)
     DEC FADE_COUNTER
  END

  //This prevent negative values in the variable
  FADE_COUNTER=MAX(0,FADE_COUNTER)

  GPUTCHR 200,120,TEXT$,1,1,COL

END

OK will try that