I'm making an RPG, need help with collisions.

BlitzMax Forums/BlitzMax Beginners Area/I'm making an RPG, need help with collisions.

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

don't do this:
If KeyDown(KEY_RIGHT)
If !(TheTreeIsAt(x+1)) x:+1
EndIf


do this:
If KeyDown(KEY_RIGHT)
  MoveRight
EndIf

..

Method MoveRight() ' or a 'Function' if you're not using types
  ..
EndMethod

One well known programming style is to separate (G)UI from implementation. The advantage here is that some script can also move the player right by calling that Method or Function.

Btw, if this is your first game, first experience, first code, first whatever: know that probably all ppl here have zillions of RPG's/tilemapscrollers projects in their blitz directories. An RPG is not difficult because of its code (a raycasting engine requires more math skills than a classic/retro Zelda), but because of its vastness.