realbasic-games
[Top] [All Lists]

2D Overhead - hit walls?

To: realbasic-games at lists dot realsoftware dot com
Subject: 2D Overhead - hit walls?
From: Paul Kaiser <paul at illinimedia dot com>
Date: Fri, 30 Apr 2004 12:19:29 -0500
Delivered-to: realbasic-games at lists dot realsoftware dot com
List-help: <mailto:realbasic-games-request@lists.realsoftware.com?subject=help>
List-id: REALbasic Games <realbasic-games.lists.realsoftware.com>
List-post: <mailto:realbasic-games@lists.realsoftware.com>
Greetings,

Using John's SSS1.0b2 to move some TNTBasic games to RB...

I have an overhead maze-type game (similar to Gauntlet). I actually started with John's TopDown example from the SSS distrubution. I've changed a few things, one of which is that the map doesn't rotate now -- the player does.

I allow the player to rotate like an Asteroids-style ship, which is important because I want them to be able to stand in place or move, while rotating and firing their weapons, etc.

All fixed and fine EXCEPT for knowing when I have hit a wall or not. This is a result of my changes.

My character has a "speed", which is generally "1.0" units -- that's arbitrary. However, when moving the character, since I allow 32 different angles of rotation, I have to resolve that 1.0 units into corresponding Horiz and Vert values. I have done that using sin / cos to store correct values in a lookup table -- it works fine and looks good.

HOWEVER...

I think that because I am attempting to move a fractional amount, when the game looks at the "1-pixel per tile" map to see if I can move to the next location, it gets goofed up.

One "solution" that is not practical would be to have a full-scale map for checking where the characters can and cannot move. This would not be a scalable solution, though -- because of the extra memory involved, it would limit the size of maps.

Anyway, I'm looking for ideas.

I guess what I need to figure out is:
1. Am I currently hanging over the side of the current tile I am centered on? 2. If so, then on the side(s) I am hanging over on, are these tiles things that should be impassable? 3. If so, don't allow hanging over the side(s) that should be impassable.

Sorry for rambling and thinking out loud, but after re-reading this, I'm hoping it still might elicit some useful thought from the list, so I'm going to send it anyway.

Thanks,
Paul Kaiser

_______________________________________________
Unsubscribe or switch delivery mode:
<http://support.realsoftware.com/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>