Moshu MSN:
[email protected] Hello all, I haven't used a forum in forever so if I am posting wrong plz let me know. I am trying to earn a title on this forum. I will mostly post in source edits. I just downloaded EE2.7 and VB6 two days ago. I have never coded using vb6 just the vb.net, C#/XNA, C++, GML, etc. I was watching the code run in debug, and found out that when the player moves its xOffset and yOffset are set to the +/- value of PIC_X ad PIC_Y. PIC_X & Y are 32 and also represent width and height of the tile system. Each step your speed is add/subtracted from X & Y offsets. Once it hits zero you have moved to the next tile. So i just added in a extra offset to each move to make diagonal movement. GM speed is 4 so each step player moves +/- 4 from offset. also to note that the up/down keys -/+ X & Y values the same so if speed is 4 X & Y offset both get -/+ 4\. left/right keys will do opposite operations to X & Y offset one gets added to one subtracted from. ***Known Bugs Working On Fixing****LOOKING FOR HELP ON HOW TO FIX THIS 1\. Once camera is away from edge of map and then meets edge of map again it will cause a small jump with player. 2\. ~~If player touches Top,Left, or Right edge of map it will cause a lil jump.~~ Fixed 2/20/09 :cheesy: 3\. ~~Run needs to be coded its right below walk code alter the same way the walk i upload a version that has run coded in also. If you run now u will keep going.~~ Fixed 4\. Correct player jump when online with diagonal code. Added 2/21/09 I wanted to go ahead and post it cuz i can't work on it today =( maybe someone can help save some time=). I know bugs are related to camera movement and player movement so I should fix it soon. **ctrl + F = find text, in vb6 you can search all the code for a certain string** Where I put my name as a comment is where I have changed the source code I can't make exe's for some reason so you have to use vb6 to see diagonal movement Download my source Here–--->[Click Me - Updated 2/20/09](http://www.filefactory.com/file/af1hega/n/fixedwallbounce_rar) Hope this will impress you guys if not I tried haha always looking for Rep++ Now to the code STEP 1-Open **modGameLogic**.bas(solution explorer>modules) in VB6 and Find sub CheckMovement Cut and paste my sub from below. ``` Sub CheckMovement() If Not GettingMap Then If IsTryingToMove Then If CanMove Then ' Check if player has the shift key down for running If ShiftDown Then Player(MyIndex).Moving = MOVING_RUNNING Else Player(MyIndex).Moving = MOVING_WALKING End If Select Case GetPlayerDir(MyIndex) Case DIR_UP Call SendPlayerMove Player(MyIndex).yOffset = PIC_Y Player(MyIndex).xOffset = PIC_X 'Moshu----------- Call SetPlayerY(MyIndex, GetPlayerY(MyIndex) - 1) Call SetPlayerX(MyIndex, GetPlayerX(MyIndex) - 1) 'Moshu----------- Case DIR_DOWN Call SendPlayerMove Player(MyIndex).yOffset = PIC_Y * -1 Player(MyIndex).xOffset = PIC_X * -1 'Moshu----------- Call SetPlayerY(MyIndex, GetPlayerY(MyIndex) + 1) Call SetPlayerX(MyIndex, GetPlayerX(MyIndex) + 1) 'Moshu----------- Case DIR_LEFT Call SendPlayerMove Player(MyIndex).xOffset = PIC_X Player(MyIndex).yOffset = PIC_Y * -1 'Moshu----------- Call SetPlayerX(MyIndex, GetPlayerX(MyIndex) - 1) Call SetPlayerY(MyIndex, GetPlayerY(MyIndex) + 1) 'Moshu----------- Case DIR_RIGHT Call SendPlayerMove Player(MyIndex).xOffset = PIC_X * -1 Player(MyIndex).yOffset = PIC_Y 'Moshu----------- Call SetPlayerX(MyIndex, GetPlayerX(MyIndex) + 1) Call SetPlayerY(MyIndex, GetPlayerY(MyIndex) - 1) 'Moshu----------- End Select ' Gotta check :) If Map(GetPlayerMap(MyIndex)).Tile(GetPlayerX(MyIndex), GetPlayerY(MyIndex)).Type = TILE_TYPE_WARP Then GettingMap = True End If End If End If End If End Sub ```Step 2: Next find **ProcessMovement** sub its in the same module **modGameLogic** cut and paste my sub from below. ``` Sub ProcessMovement(ByVal Index As Long) ' Check if player is walking, and if so process moving them over If Player(Index).Moving = MOVING_WALKING Then If Player(Index).Access > 0 Then If SS_WALK_SPEED 0 Then Select Case GetPlayerDir(Index) Case DIR_UP Player(Index).yOffset = Player(Index).yOffset - SS_WALK_SPEED Player(Index).xOffset = Player(Index).xOffset - SS_WALK_SPEED 'Moshu Case DIR_DOWN Player(Index).yOffset = Player(Index).yOffset + SS_WALK_SPEED Player(Index).xOffset = Player(Index).xOffset + SS_WALK_SPEED 'Moshu Case DIR_LEFT Player(Index).xOffset = Player(Index).xOffset - SS_WALK_SPEED Player(Index).yOffset = Player(Index).yOffset + SS_WALK_SPEED 'Moshu Case DIR_RIGHT Player(Index).xOffset = Player(Index).xOffset + SS_WALK_SPEED Player(Index).yOffset = Player(Index).yOffset - SS_WALK_SPEED 'Moshu End Select Else Select Case GetPlayerDir(Index) Case DIR_UP Player(Index).yOffset = Player(Index).yOffset - GM_WALK_SPEED Player(Index).xOffset = Player(Index).xOffset - GM_WALK_SPEED 'Moshu Case DIR_DOWN Player(Index).yOffset = Player(Index).yOffset + GM_WALK_SPEED Player(Index).xOffset = Player(Index).xOffset + GM_WALK_SPEED 'Moshu Case DIR_LEFT Player(Index).xOffset = Player(Index).xOffset - GM_WALK_SPEED Player(Index).yOffset = Player(Index).yOffset + GM_WALK_SPEED 'Moshu Case DIR_RIGHT Player(Index).xOffset = Player(Index).xOffset + GM_WALK_SPEED Player(Index).yOffset = Player(Index).yOffset - GM_WALK_SPEED 'Moshu End Select End If Else If SS_WALK_SPEED 0 Then Select Case GetPlayerDir(Index) Case DIR_UP Player(Index).yOffset = Player(Index).yOffset - SS_WALK_SPEED Player(Index).xOffset = Player(Index).xOffset - SS_WALK_SPEED 'Moshu Case DIR_DOWN Player(Index).yOffset = Player(Index).yOffset + SS_WALK_SPEED Player(Index).xOffset = Player(Index).xOffset + SS_WALK_SPEED 'Moshu Case DIR_LEFT Player(Index).xOffset = Player(Index).xOffset - SS_WALK_SPEED Player(Index).yOffset = Player(Index).yOffset + SS_WALK_SPEED 'Moshu Case DIR_RIGHT Player(Index).xOffset = Player(Index).xOffset + SS_WALK_SPEED Player(Index).yOffset = Player(Index).yOffset - SS_WALK_SPEED 'Moshu End Select Else Select Case GetPlayerDir(Index) Case DIR_UP Player(Index).yOffset = Player(Index).yOffset - WALK_SPEED Player(Index).xOffset = Player(Index).xOffset - WALK_SPEED 'Moshu Case DIR_DOWN Player(Index).yOffset = Player(Index).yOffset + WALK_SPEED Player(Index).xOffset = Player(Index).xOffset + WALK_SPEED 'Moshu Case DIR_LEFT Player(Index).xOffset = Player(Index).xOffset - WALK_SPEED Player(Index).yOffset = Player(Index).yOffset + WALK_SPEED 'Moshu Case DIR_RIGHT Player(Index).xOffset = Player(Index).xOffset + WALK_SPEED Player(Index).yOffset = Player(Index).yOffset - WALK_SPEED 'Moshu End Select End If End If ```Step3: Now open module **HandleData** and Ctrl + F and search for this string –> Player movement packet This is not a sub or function its a IF statement so make sure you cut and paste it in like it is in file=) Next cut and paste my code from below ``` ' :::::::::::::::::::::::::::: ' :: Player movement packet :: ' :::::::::::::::::::::::::::: If (casestring = "playermove") Then i = Val(parse(1)) X = Val(parse(2)) y = Val(parse(3)) Dir = Val(parse(4)) n = Val(parse(5)) If Dir < DIR_UP Or Dir > DIR_RIGHT Then Exit Sub End If Call SetPlayerX(i, X) Call SetPlayerY(i, y) Call SetPlayerDir(i, Dir) Player(i).xOffset = 0 Player(i).yOffset = 0 Player(i).Moving = n ' Replaced with the one from TE. Select Case GetPlayerDir(i) Case DIR_UP Player(i).yOffset = PIC_Y Player(i).xOffset = PIC_X 'Moshu----- Case DIR_DOWN Player(i).yOffset = PIC_Y * -1 Player(i).xOffset = PIC_X * -1 'Moshu----- Case DIR_LEFT Player(i).xOffset = PIC_X Player(i).yOffset = PIC_Y 'Moshu----- Case DIR_RIGHT Player(i).xOffset = PIC_X * -1 Player(i).yOffset = PIC_Y * -1 'Moshu----- End Select Exit Sub End If ```Wall bounce fix 4 lines of code total =) Locate the **CanMove** function in **modGameLogic** cut/paste code below this will be at top of function you will see it. ``` X = GetPlayerX(MyIndex) y = GetPlayerY(MyIndex) If DirUp Then Call SetPlayerDir(MyIndex, DIR_UP) X = X - 1 'moshu This lines here fix the wall bounce caused when play walks down map wall y = y - 1 ElseIf DirDown Then Call SetPlayerDir(MyIndex, DIR_DOWN) y = y + 1 X = X + 1 'moshu ElseIf DirLeft Then Call SetPlayerDir(MyIndex, DIR_LEFT) X = X - 1 y = y + 1 'moshu Else Call SetPlayerDir(MyIndex, DIR_RIGHT) X = X + 1 y = y - 1 'moshu End If ``` Download my source Here–--->[Click Me - Updated 2/20/09](http://www.mediafire.com/?m4kyeei1ydi) Thats it for now I will post updated verison of it later I will always try to work from a unedited source of EE2.7 that tut's are ez to follow. Moshu MSN:
[email protected]