Post

 Resources 

Console

Home | Profile | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 VBGamer
 VBGamer
 Help with avoiding walls

Note: You must be registered in order to post a reply.

Screensize:
UserName:
Password:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkInsert EmailInsert Image Insert CodeInsert QuoteInsert List Spell Checker
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

   Insert an File
Check here to include your profile signature.
Check here to subscribe to this topic.
    

T O P I C    R E V I E W
alyien Posted - Aug 15 2003 : 6:24:21 PM
Hey all,
having a bit of a problem with a mini RPG sample game I am converting from a mac C++ sample (though I don't know C++ so I am doing the whole thing from VB in scratch, those of you who read "Tricks of the Mac Game Programming Gurus" would have seen this). I have barely gotten into this game yet because I am having trouble with the basics..."movement", also this would be an easy task to accomplish with the keyboard, with with mouse this type of collision detection proves more difficult (for a novice like me anyways :)). If you all look in the Picture1_MouseDown procedure
-------------------------------------------------------
Dim OldX As Integer
Dim OldY As Integer
Dim MonsterIndex As Integer
Dim NewTerrain As Integer

OldX = Chars(0).X
OldY = Chars(0).Y

If (X / 32) > (Chars(0).X + 1) Then
Chars(0).X = Chars(0).X + 1
End If
If (X / 32) < Chars(0).X Then
Chars(0).X = Chars(0).X - 1
End If
If (Y / 32) > (Chars(0).Y + 1) Then
Chars(0).Y = Chars(0).Y + 1
End If

If (Y / 32) < Chars(0).Y Then
Chars(0).Y = Chars(0).Y - 1
End If

NewTerrain = TerrainVal(Mid(MapValues(Chars(0).Y), Chars(0).X, 1))

If NewTerrain = 1 Then
Beep
Chars(0).X = OldX
Chars(0).Y = OldY
ElseIf NewTerrain = 2 Then
GetGold Chars(0).X, Chars(0).Y
ElseIf NewTerrain = 3 Then
End
End If
'If IsMonster(Chars(0).X, Chars(0).Y) Then
' MonsterIndex = MonsterAt(Chars(0).X, Chars(0).Y)
' Chars(0).X = OldX
' Chars(0).Y = OldY
' Attack 0, MonsterIndex
'End If

'RandomizeMonsters

PaintMap
End Sub
-------------------------------------------------------
(The whole project file is available on the site mentioned at the end of this post)
I have tried many variations of this method, however this one seems to be the only light of hope. However it seems that it always detects walls (NewTerrain = 1), though if the following lines are commented out
If NewTerrain = 1 Then
Beep
'Chars(0).X = OldX
'Chars(0).Y = OldY
it moves quite smoothly, however you can tell it is still constantly thinking that you are on a wall which is proven by the ever annoying "Beep". Turn these lines off and you quickly find out that you cannot move far at all.
I know this method works fine with the keyboard, but the mouse is the wave of the future :), so I really wanna get that going for this sample :) :). PLuS the original Mac C++ sample used the mouse and I wanna make an exact replica of it for practice, and likely turn it into a PSC code tutorial.
Any help is appreciated and will be added to the "Credits" section of the game (once I get the menu created, heh).
And I know that code snippet above doesn't tell you guys much so I'll post the whole project here:
http://www.geocities.com/ggamer2k3/DUNGEON1.zip

BTW I am using VB3 for this code simply because I usually code on an older machine (for now anyway), however I have also included a VB6 version in the above zip file.

Any questions or comments send to "alyien@yablue.com" or simply reply to this post ^_^.

Keep VBing everyone
1   L A T E S T    R E P L I E S    (Newest First)
cbx Posted - Aug 17 2003 : 02:50:14 AM
by the way before anyone posts msgs about the http://www.geocities.com/ggamer2k3/DUNGEON1.zip link being broken geocities prevents people from file leaching off of there users sites.

To down load the DUNGEON1.zip file first visit the site at http://www.geocities.com/ggamer2k3/" target="_blank">http://www.geocities.com/ggamer2k3/ then paste http://www.geocities.com/ggamer2k3/DUNGEON1.zip into the addressbar to download the file.

VBGamer © Go To Top Of Page
This page was generated in 0.11 seconds. Snitz Forums 2000

Copyright © 2002 - 2004 Eric Coleman, Peter Kuchnio , et. al.