Hi, folks,
I've been scratching for a while now and have had this persistent problem - when I make a character (Typically in a top-down game) I want to set some boundaries for my environment. Currently, the player's character points towards the mouse, and is moved up with W, down with S, and so on.
However, I seem to have trouble with making my walls work properly - the character will either simply pass through, or, if I hit multiple buttons at once, will glide along the edge, then land inside the wall.
How should I go about stopping this? I've got some nice games I've been working on for a while that are rather flawed because of this.
Any & all help is appreciated.
Cheers,
- 3D
Last edited by 3DBlenderRender (2011-12-09 02:07:31)
Offline
You want to make the walls into a sprite and then color the sides ONLY. Make a note of these colors, you'll need them later. Edit the character sprite and if there's yellow on the left side and green on the right side of the wall, put yellow on the right side of the cat and green on the left. I generally use the bottom of feet, farthest part of arms, etc. and the tips of head. Just put it in a different sprite. Then, change the uncolored parts to blank, and tell it to go to the character and set ghost to 100.
Sorry, I think you need someone else to help with most of the script.
Offline
Never-mind, upon looking at the script, I realized that I needed a simultaneous check of keys pressed, so that dual-directional movements would be cancelled.
Besides, to you both, color sensing isn't an option, as the backgrounds are rather complex in color and such...for example, this - http://fc01.deviantart.net/fs70/f/2011/343/0/5/lvl_1___cage_by_3dblenderrender-d4ilzqa.png - has many, many different color/shade variants in it, making color sensing not an option, so my boundaries with simultaneous checking more reliable. Of course, it's the obvious option, but in general it results in poor graphics...thanks though!
Cheers,
- 3D
Offline
I'm making a project where my sprite follows the mouse, and in my background there's grass and sky, with a line sprite bordering them. How can I make my sprite follow the mouse but not go past the border sprite?
Offline
lardy wrote:
I'm making a project where my sprite follows the mouse, and in my background there's grass and sky, with a line sprite bordering them. How can I make my sprite follow the mouse but not go past the border sprite?
Try something like this:
It won't go past the border coming from the right, but after it's pointing at least parallel to the border, it can go past it.
Does that help?
Offline