Really need help!
Blitz3D Forums/Blitz3D Beginners Area/Really need help!| 
 | ||
| Ok i am making a rpg and I have one problem so far. You see, the player can move on the screen, but you need to move over screens. Like think of this... XX XX XO There are 6 screens. You start in the "O" screen. How would i get the person to move screens useing the wasd keys? here is some code below. If i do this code, it will move, but only for a milli sec. How would i get the person to stay on the screen he is trying to go too? He would see the arrows to see what direction is available. (ex. arrowu would be a up arrow and would mean "press w to go up a screen) Please help asap! Thanks | 
| 
 | ||
| First of all, you need to learn to identate. Without it most people won't even look at your code. Like this: 
Function leveldraw()  
   If image$=background1 
      If KeyHit(17) ;w 
         image$=background3 
      EndIf
   EndIf 
End function
You have all the special cases laid out, like if a player is in particular screen and he hits a particular key, then he is moved to another screen. This is easier done kinda like this: ;First, make the image$ a global variable, I think that is your problem. Global image$ = background1 Dim Map$(1,2) Map(1,2) = background1 Map(0,2) = background2 ..etc Global PlayerX=1,PlayerY=2 ;Player input If KeyHit(17) Then PlayerY = PlayerY - 1 ;etc for each key image$ = Map$(PlayerX,PlayerY) | 
| 
 | ||
| Ok thanks for your help! I do not understand the code tho. I understand this part: Global image$ = background1 Global PlayerX=1,PlayerY=2 but i do not understand the rest. :( please help when you can and thanks so far. | 
| 
 | ||
| Dim Map$(1,2) ;We'll create a array of 2x3 size (Blitz array size is one larger than defined.. Map(1,2) = background1 ;Then we assign the correct background image to the array Map(0,2) = background2 ..etc Global PlayerX=1,PlayerY=2 ;We create the current position of the player ;Player input If KeyHit(17) Then PlayerY = PlayerY - 1 ;If W is hit, move player UP ;etc for each key image$ = Map$(PlayerX,PlayerY) ;At the end of every loop/input function assign the correct map from the array Read up on arrays (Called Dim's in Blitz) for more information. |