Ok wow ive been working 3 stright hours and i need more help :(
1) I need help overwriting saved files...
2) How would i get my person to move screen to screen?
Like i have 6 screens and you need to be in one to get to another one. So i have arrows and if you hit the wasd keys (w is up,a is left ect.) how would i move? Its in level draw i think... heres new code...
1) I need help overwriting saved files...
2) How would i get my person to move screen to screen?
Like i have 6 screens and you need to be in one to get to another one. So i have arrows and if you hit the wasd keys (w is up,a is left ect.) how would i move? Its in level draw i think... heres new code...
Graphics 800,600,32,2 AppTitle "RPG" AutoMidHandle True SeedRnd(MilliSecs()) login() ;Constants Const UPKEY=200 Const DOWNKEY=208 Const LEFTKEY=203 Const RIGHTKEY=205 ;Images Global mf$,name$,password$,ww$,l$,I$,m$,image$ Global castle=LoadImage("castle.bmp") Global house=LoadImage("house.bmp") Global background1=LoadImage("background.bmp") Global background2=LoadImage("background.bmp") Global background3=LoadImage("background.bmp") Global background4=LoadImage("background.bmp") Global background5=LoadImage("background.bmp") Global background6=LoadImage("background.bmp") Global wizard=LoadImage("wizard.bmp") Global wizblur=LoadImage("wizard blur.bmp") Global invis=LoadImage("invisable.bmp") Global rat=LoadImage("rat.bmp") Global wich=LoadImage("wich.bmp") Global wichblur=LoadImage("wich blur.bmp") Global man=LoadImage("man.bmp") Global women=LoadImage("women.bmp") Global curser=LoadImage("curser.bmp") Global arrowu=LoadImage("arrow up.bmp") Global arrowd=LoadImage("arrow down.bmp") Global arrowr=LoadImage("arrow right.bmp") Global arrowl=LoadImage("arrow left.bmp") Global map=LoadImage("map.bmp") Global inventory=LoadImage("backpack.bmp") Global money=LoadImage("coin.bmp") Global sword=LoadImage("sword.bmp") Global bone=LoadImage("bone.bmp") ;Types Type player Field x,y Field hitpoints% Field name$ Field items$ End Type Type monster Field hitpoints% End Type ;Type INI Global player.player=New player ;Initalization typeini() ;Main Loop x = 50 y = 50 While Not KeyDown(1) ;Esc Cls If KeyDown(19) rules() EndIf If KeyDown(35) help EndIf If KeyDown(50) Cls DrawImage map,400,300 WaitMouse() EndIf leveldraw() playermovement() leveltrans() HidePointer DrawImage curser, MouseX (), MouseY () Flip Wend ;Functions Function leveldraw() image$=background1 If image$=background1 If KeyHit(17) ;w image$=background3 EndIf EndIf If image$=background3 If KeyHit(17) ;w image$=background5 If KeyHit(30) ;a image$=background4 If KeyHit(31) image$=background1 EndIf EndIf EndIf EndIf If image$=background2 If KeyHit(17) ;w image$=background4 EndIf EndIf If image$=background4 If KeyHit(32) ;d image$=background3 If KeyHit(31) ;s image$=background2 EndIf EndIf EndIf If image$=background5 If KeyHit(31) ;s image$=background3 If KeyHit(30) ;a image$=background6 EndIf EndIf EndIf If image$=background1 If KeyHit(32) ;d image$=background5 EndIf EndIf TileImage image$ If image$=background1 DrawImage arrowu,400,40 EndIf If image$=background2 DrawImage arrowu,400,40 EndIf If image$=background3 DrawImage arrowu,400,40 DrawImage arrowl,40,300 DrawImage arrowd,400,560 EndIf If image$=background4 DrawImage arrowr,760,300 DrawImage arrowd,400,560 EndIf If image$=background5 DrawImage arrowl,40,300 DrawImage arrowd,400,560 EndIf If image$=background6 DrawImage arrowr,760,300 EndIf HUD() If ww$="wich" DrawImage wich,player\x,player\y Else If mf$="female" DrawImage women,player\x,player\y EndIf EndIf If ww$="wizard" DrawImage wizard,player\x,player\y Else If mf$="male" DrawImage man,player\x,player\y EndIf EndIf End Function Function typeini() player\x=500 player\y=100 player\hitpoints%=10 End Function Function playermovement() If KeyDown(UPKEY) player\y=player\y-3 ElseIf KeyDown(DOWNKEY) player\y=player\y+3 ElseIf KeyDown(RIGHTKEY) player\x=player\x+3 ElseIf KeyDown(LEFTKEY) player\x=player\x-3 EndIf End Function Function leveltrans() If player\x=>1018 player\x=player\x-1017 ElseIf player\x=<6 player\x=player\x+1018 ElseIf player\y=>701 player\y=player\y-700 ElseIf player\y=<5 player\y=player\y+695 EndIf End Function Function HUD() Color 250,0,0 Text 1,1,"Health: " + player\hitpoints% + "" End Function Function login() Print "Checking for info" filein = ReadFile("userinfo.txt") If filein <> 0 name = ReadLine$(filein) password = ReadLine$(filein) mf$ = ReadLine$(filein) Print "Name: " + name + "" pass$=Input("Password: ") If pass$=password$ Print "Welcome " + name + "!" Delay 2000 Else Print "Wrong!" Delay 3000 End EndIf Else Print "You are a new user, please create an account:" Print "" name = Input$("Enter a new name: ") password$ = Input$("Enter a new password: ") mf$ = Input$("male or female: ") fileout = WriteFile("userinfo.txt") WriteLine(fileout,name) WriteLine(fileout,password$) WriteLine(fileout,mf$) CloseFile fileout Print "" Print "Thank you, you are automatically logged in" Delay 3000 End If End Function Function help() Cls Print "If you see a red arrow, use the WASD keys like arrow keys" Print "to move to a new page. The M key is your map. Red blocks" Print "on the map mean you can go that way. Arrows on your screen" Print "tell you the same. Pressing the ENTER key brings you to chat." Print "Pressing it again sends your message. The R key shows you the" Print "rules. I is inventory and to talk to a npc, click on them." Print "Thats it for now :). Click To continue..." WaitKey() End Function Function rules() Cls Print "1) No bad lanuage." Print "2) No useing 3rd party softwear.(ex. auto talker,skiller...)" Print "3) No hacking or cheating." Print "4) No creating private servers." Print "5) Try not to be rude." Print "Click to continue..." WaitMouse() End Function Function inventory() End Function