Jump to content


Photo

NO HELP REQUIRED!


  • Please log in to reply
5 replies to this topic

#1 Mr.Troid

Mr.Troid

    GMC Member

  • New Member
  • 114 posts

Posted 19 April 2012 - 02:42 AM

NO HELP REQUIRED!

Edited by Mr.Troid, 10 September 2012 - 02:51 AM.

  • 0

#2 FoxInABox

FoxInABox

    GMC Member

  • GMC Member
  • 5395 posts
  • Version:GM:Studio

Posted 19 April 2012 - 01:45 PM

you can loop thru the string one letter at a time and draw each like this:
str="this is a /i test" // and you want to replace /i with a image
var i,c,w;
i=0; // i is the position in the string, c is the character at that position
w=0; // is total width of all characters written so far

while(i<string_length(str)){ i+=1; // I incrase i at top since the first string position is at 1

c=string_char_at(str,i) // get the character

// here you can check for spesific letters

draw_text(x+w,y,c) // draw the character

w+=string_width(c) // move the width by the size of the character that was drawn
}
at the place that you can search for spesific letters you might want to use a code somewhat like this:
if c="/"{ // check if c is / ..
  if string_char_at(str,i+1)="i"{ // if it the character after it is i so it is /i .. then:
    draw_sprite(spr_image,0,x+w,y) // draw it where we would draw text
    w+=32; // add some to width based on width of the sprite
    i+=1; // i is incrased by 1 at the top, and and it need to move an additional one to reach the space after /i
    continue; // this will jump to the top of the loop, so that the draw_text part is not performed
  }
}

and yes, you could change alpha if you use draw_sprite_ext and draw_text_ext and just have a variable that decrase from 1 to 0 slowly, even animate the sprites and give it a typewriter/wave effect (I luv the wave eff.) , totaly up to you x3
  • 0

#3 Mr.Troid

Mr.Troid

    GMC Member

  • New Member
  • 114 posts

Posted 19 April 2012 - 09:35 PM

Thanks, I'll try it and see how it works.
  • 0

#4 Mr.Troid

Mr.Troid

    GMC Member

  • New Member
  • 114 posts

Posted 19 April 2012 - 09:52 PM

Nope it didn't work. I put all of the code in the draw event. What am I doing wrong?
  • 0

#5 FoxInABox

FoxInABox

    GMC Member

  • GMC Member
  • 5395 posts
  • Version:GM:Studio

Posted 19 April 2012 - 09:57 PM

I tested it .. works fine, I guess you didn't read it well enough x3

put the 2nd code piece where it says "// here you can check for spesific letters" in the first code..

I just made them seperate so they should make more sence
  • 0

#6 Mr.Troid

Mr.Troid

    GMC Member

  • New Member
  • 114 posts

Posted 19 April 2012 - 10:03 PM

...OOOOOOH! Okay, now it's working. I knew I was doing something wrong. Thanks Fox.

Edited by Mr.Troid, 19 April 2012 - 10:04 PM.

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users