Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with Lingo

Status
Not open for further replies.

DaneshD

Programmer
Dec 10, 2004
19
SE
Hi all,

I have written a simple game in Lingo using Macromedia Director 2004 MX. So far I have designed a character which moves by pressing arrow keys. Also, I have used this technic to move background instead my character. In other words, I move bacckground to right, left, up and down to show my character is moving within a square frame. Now the problem is that I want to change the game, so when the character is at the end of a way, my frame stops. Right now, when my character reachs end of a way the frame still moves to the empty (black background) place but I want to make it stop however the user is pressing the arrow key. Can anybody help about this?

Regards,

Danesh

 

While moving the background image instead of the player is a good idea, you may need to find a better method (for example, what happens when you have enemies moving round the level too?)

The method I would use would be to store the player's 'h' and 'v' position in variables (properties), and when the player moves, adjust these h and v variables, and not the sprite's h and v position.

Then, you can calculate where the player's sprite should be displayed, by adding his 'h' and 'v' variables, to the top-left position of your background image.

This way, you can then move your background image so that the player stays roughly in the middle of the screen, but in your programming, your code is 'theorectically' moving the player instead of the background. This will make it much easier for you to move on to your current problem which is the collision detection.

There are a lot of ways to approach this (collision detection), it's really a very large area and probably can't be answered as a single question. Instead I would advise that you do some google searches for phrases like:

"2d collision detection"
"tile based collision detection"
"lingo collision detection"

And read around the subject that you are tackling. You'll find there are many different methods available, and you'll have to decide which method suits the kind of game you are making.

hope this helps!

- Ben


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top