Jump to content


@rpp3

Member Since 27 Jan 2010
Offline Last Active May 25 2011 01:41 AM

Topics I've Started

Get Name

24 May 2011 - 11:26 PM

Hi, first of all this is not my code, I recently found a nice engine for scrolling zelda text, and now I want the user to be able to input his/her name. to do this I tried making my own script by changing the original a bit, but it doesnt seem to work and im not sure why, i dont come on these forums often because normally i solve my problems by myself but this is frustrating me and I will add whoever can help me under the credits as "My Hero" or something :P this is really important to me and any help is appreciated

so, here is the original code, the arguments are (x,y,message,speed)
var newtext,text,xx,yy,replace,line,font,back;
font = spr_Font
xx = 10;
yy = 16;
line = 0;
text = argument2 
i=0

draw_sprite(spr_Textbox,-1,argument0,argument1+8) 
while i<string_length(argument2) 
{  
i+=1
newtext = string_copy(text,i,1)
if newtext = " "
{
replace=string_copy(text,i+1,string_length(text)-i)+' ' 
replace=string_replace_all(replace,'^','') 
replace=string_replace_all(replace,'%','')
replace=string_replace_all(replace,'*','')
replace=string_pos(' ',replace)-1
if xx+8*replace>(sprite_get_width(spr_Textbox)-16) 
{ 
line+=1
xx = 2; 
yy+=16;
}
}
if line=3
{
line = 0
keyboard_wait()
xx = 2
yy = 16
screen_redraw()
draw_sprite(spr_Textbox,-1,argument0+8,argument1+8) 
}
switch newtext  
{ 
case "^": // "^" = red
font = spr_RFont 
continue; 
break;
case "%": // "%" = blue
font = spr_BFont
continue; 
break;
case "*": // "*" = green
font = spr_GFont 
continue; 
break; 
case " ": // def colour  
font = spr_Font
}            
xx+=8 
str = string_to_number(newtext) 
draw_sprite(font,str,argument0+xx,argument1+yy)  
screen_refresh() 
sleep(((100-(60*keyboard_check(vk_space))))/argument3) 
if i=string_length(text)
break;
}
if newtext!="" 
{
sound_play(text_finish)
draw_sprite(spr_Textmore,-1,argument0+(sprite_get_width(spr_Textbox)/1.1),argument1+(sprite_get_height(spr_Textbox)+2))
screen_refresh()
keyboard_wait()
}
else 
draw_text_scrolling(argument0,argument1,argument2,argument3) 

My version of this code is very similar, same arguments, except after going through the scrolling text displaying the message, my idea was to have a while statement that only exits when the user hits enter, and the name would be set to the keyboard_string which gets drawn with the same font sprites. this code probably wont work without resources so I will post the engine i downloaded and if you are trial and error like me you can replace the script with mine

http://gmc.yoyogames.com/index.php?showtopic=479384

var newtext,text,xx,yy,replace,line,font;
font = spr_Font
xx = 10;
yy = 16;
line = 0;
text = argument2 
i=0

draw_sprite(spr_Textbox,-1,argument0,argument1+8) 
while i<string_length(argument2) 
{  
i+=1
newtext = string_copy(text,i,1)
if newtext = " "
{
replace=string_copy(text,i+1,string_length(text)-i)+' ' 
replace=string_replace_all(replace,'^','') 
replace=string_replace_all(replace,'%','')
replace=string_replace_all(replace,'*','')
replace=string_pos(' ',replace)-1
if xx+8*replace>(sprite_get_width(spr_Textbox)-16) 
{ 
line+=1
xx = 2; 
yy+=16;
}
}
if line=3
{
line = 0
keyboard_wait()
xx = 2
yy = 16
screen_redraw()
draw_sprite(spr_Textbox,-1,argument0+8,argument1+8) 
}
switch newtext  
{ 
case "^": // "^" = red
font = spr_RFont 
continue; 
break;
case "%": // "%" = blue
font = spr_BFont
continue; 
break;
case "*": // "*" = green
font = spr_GFont 
continue; 
break; 
case " ": // def colour  
font = spr_Font
}            
xx+=8 
str = string_to_number(newtext) 
draw_sprite(font,str,argument0+xx,argument1+yy)  
screen_refresh() 
sleep(((100-(60*keyboard_check(vk_space))))/argument3) 
if i=string_length(text)
break;
}
if newtext!="" 
{
sound_play(text_finish)
xx=2
yy+=16
while (keyboard_check(vk_enter)=false)
{
for (i=0; i<string_length(keyboard_string); i+=1)
{
draw_sprite(spr_Font,string_char_at(keyboard_string,i),argument0+xx,argument1+yy) ;
};
name=keyboard_string
screen_refresh()
}
}
else 
draw_text_scrolling(argument0,argument1,argument2,argument3) 

Again, any help is seriously appreciated!!

Downward slope animation

31 October 2010 - 09:04 PM

I have a game, and I use this code for my slopes

if keyboard_check(vk_left)
{
  for (i = 0; i<= 8; i += 1;)
    {//check to see if you are goin up a ramp. 
    if place_free(x-argument0,y-i)
      {
      x-= argument0; y-= i; exit;
      }
    }
}

My player animates perfectly when going up these slopes, but when He goes down, he bounces. This is because he is actually falling, and landing and falling and landing on the slope. I was wondering if anyone could help me figure out a code to move the character down the slope as smoothly as he moves up. If you understand this code (because I dont, I just copy-pasted it) can you also explain it to me? What is the purpose of (1 = 0; i<=8; i += 1;)? Any help is appreciated :D

I need help with platform collisions!

20 October 2010 - 02:42 AM

Thanks for reading this, I have a game where you are a smiley face that rolls through a classic level, and there are lots of glitches, and please skip to the level with the canon if you want to see for yourself. I put this on the internet because the problem is something that needs trial and error, and possibly some of your code if you are up to it. I really think anyone but me can solve this and its just me being stupid again. I will most likely hit myself when I get an answer. If you try to help, make sure your code works with the other parts of the game :D if you have any questions, I will be checking this frequently for the next 45 min, and possibly after that, heres my game - http://www.yoyogames...-smiley  please help me

Moving Platforms (vertical & horizontal)

02 October 2010 - 06:55 PM

Hi, I have already done a lot of searching and Ive tried many different codes out with my game, but I think something I did earlier on in the game with my player affects these codes, because none of them seem to work. There are lots of things that could be keeping the codes from working, so I have decided to put my game online. If anyone has a minute or two, could you please take a look at the game and tell me what im doing wrong? It would be very appreciated :D

My game is here ---> link

Please help me :D

Whooops, that link doesnt work, give me a minute...

ha ha, slow internet...  <_<

there link and the pictures have nothing to do with the game

sprite_create_from_screen()

04 August 2010 - 02:37 AM

for som reason, sprite_create_from_screen() isnt capturing the sprites in my game,, it only makes a sprite of the backgrounds and tiles. here is my code, can anyone help me?

if pause=false{
instance_deactivate_all(true);pause=true;tempspr=sprite_create_from_screen(0,0,view_wview[0],view_hview[0],0,0,0,0)
var col; 
col=make_color_rgb(210,210,210) 
draw_sprite_blur_ext(tempspr,-1,0,0,1,1,0,col,1,4);exit}
if pause=true{
instance_activate_all();pause=false}