The game is a turn based rpg that takes place within rooms in a dungeon. Each tile in my game is 32 pixels. Players hop along the grid one turn at a time and then monsters make their movements. I currently have each wall set as duplicates of the same tile. When the player hits the left key, I have the character move 32 pixels to the left. I cant think of a simple way to determine if there is a wall in the way of the player. If I could negate a condition where a collision marker to the left of the player is touching a wall then I could do this. Could someone start me in the right direction in this type of engine or know of an appropriate tutorial or example?
It's actually very easy!
It involves the use of "detectors", detectors are simply invisible active objects that always stay positioned relative to the player. Then you can use these detectors to calculate if the player is next to an obstacle. You can check out this article, it's quite old and overcomplicated, but the principle is the same.
http://www.create-games.com/article.asp?id=200
If you still have problems with it you can post a topic asking for help in the "Code it" forum, this topic should actually be there. But no worries!
Hope it works out for you!
//EE
You could also just create a small active object next to the player based on whatever direction they want to move in. Then if it isn't overlapping anything = move it, if it is overlapping = don't move.
Although that way is a bit more complex than just having 4 permanent detectors.
Odd. So you can't negate collisions, but you can negate overlapping. This is perfect. When you say its a little more complicated than that I assume you mean doors and monsters and what not but I already have an elegant solution planned for that.
It's more complicated because it creates then destroys the object almost instantly instead of having 4 all the time that follow the character.
I meant something like this.
Upon pressing Down = open group DOWNMOVE
DOWNMOVE GROUP
--------------
create detector below player
if detector is not overlapping a wall or door --> move player +32
destroy detector
close group
-----------
You don't have to destroy the detectors, just make them invisible and not allow the player to move if a detector is overlapping a wall, door, etc.
If [player presses left] AND [(negate)LeftDetector overlapping a wall]
..then go left.
I could see you going through a lot more trouble making the enemies move, though.
Umm... a bit off topic, but why would you make a roguelike in MMF? Most other 'tools' have the least problems making a roguelike compared to say an action game or something. MMF actually has trouble making it into a turn-based grid game thing because of how it works.
Not to criticize or anything. I have a text-based game in MMF on the works. Just saying that maybe with a little creative thinking, you could do something that's just as fun as a roguelike, but with a lot more features
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.
Thank you everyone for the help. It seems to be working out. It is 8 directions. I have 8 sensors that follow the character. As long as a collision sensor isn't overlapping a wall or an invisible clip block, the player can move in that direction. I'm having some complications though. I have a clip block behind a door. I have a "doormat" which is 2 32 pixel squares that are on either side of Door. if the player is on the mat and hits "O" the door animation will change to "open" and the clip block will be destroyed. When the player walks over the area where the already destroyed clip block is, he is frozen. This is not the case when he walks next to walls.
I already have a temporary inventory system set up. That leads me to a question regarding alterable values. Each inventory item is just a random animation of the single item object. If an item the player picks up has a particular animation, I want to set a bunch of alterable values to that particular frame's item. Each picked up item sits in a square in the item belt. This leads me to my question. If I have multiple "Item1" objects with different animations, can I set and retrieve independent global and alterable values from different instances of the same object?
The same goes for different monster instances from the same Monster1 object. Also, these monsters need to have their own sets of detectors, though for now I am going to have a single 96 by 96 square that follows them. For the time being they will avoid walls and have to pick a direction when moving in or near hallways/doorways. That will work for now. I already have a simplistic inventory system thought up for loot dropping based on alterable values.
This leads me to my last question. Random numbers. I'd like to retrieve alterable/global values like the player's dexterity and weapon proficiency, add them together (Global Value A+Global Value B) and then add that to the enemy's dexterity. Lets say (A+B)+C equals 15, 10 of that being the player's. I want to generate a number between 1 and 15. If the number is less than or equal to 10, I want the player to get a hit on the enemy. From there I'll do a random number check for the damage done. In the future I'll need more complex number generation, such as 1-30 being broken up into 6 possible outcomes.
As for enemy movement, I think I have that figured out. Every "turn" the enemy fires a bullet at the player. If the bullet travels in the directions 30 through 32 or 0 through 2 the enemy will move to the right. If it goes in directions 3 through 5, the enemy will move up and to the right etc until the enemy's single collision detector is touching the player, at which point he begins attacking.
You ask why I'm making a roguelike in MMF2. I have no idea how to program and MMF2 is the only program I am familiar with that I can understand for applications development other than very simple visual basic 6. VB may in fact be a better option than this, but I'd rather make quicker progress and see my ideas in action. You say I could make a game even better than a roguelike, and that is already my goal. Random dungeons, tons of unique items, extensive weapons and magic, a long list of skills, endless useful actions, branching dialogue and diplomacy skills, any part of a body can be damaged in any way imaginable accidentally or intentionally with various weapons, magic, and environmental interaction, every enemy has a unique attack and weakness. The list goes on. I want to make the roguelike I've always wanted to play. This is an engine to test ideas for future games. In other words, to my knowledge I'm making the first roguelike to have magic swords, orcs, grenades, and automatic rifles.
To those who are curious, the game will have no real story beyond some cheesy time machine explanation because there is no respectable way to account for medieval fantasy and grenades. I am planning a very elaborate story for a future game that I am sure you would all be VERY interested in, though I don't intend to elaborate to anyone that doesn't have time to contribute to the project until the development has a stable foundation. To anyone who thinks they may be interested in contributing to the game, please PM me.
Thank you all very much for the help, and in the future I'll post in the correct forum.
If I have multiple "Item1" objects with different animations, can I set and retrieve independent global and alterable values from different instances of the same object?
I'm not sure what you mean, but if different objects have different values, yeah, you can do that. But.. if you want to do "Set counter to Item1's Alterable Value A", it depends on the conditions.
On random numbers:
Number between 1 and 15 = Random(15)+1
You need the +1, otherwise, it'll generate a random number between 0 and 14.
Number between 1 and (A+B)+C = Random((A+B)+C)+1
I'd also like to warn you that the random number generator in MMF is not very random. You won't really notice the non-randomness for damage, but it shows if you use numbers to randomly pick stuff.
"In other words, to my knowledge I'm making the first roguelike to have magic swords, orcs, grenades, and automatic rifles."
Alphaman and IVAN do something similar, though IVAN doesn't have automatic rifles, I think. I'm pretty sure there are a lot more with them too.
Don't worry about story in a roguelike, the whole point is to generate random dungeons and keep yourself alive. I don't think anyone's ever done a roguelike in MMF too (if you don't count Gridquest as a roguelike), so you might get yourself a little fame by doing the first one.
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.
This particular game is for me, though I wouldn't mind a little recognition to make future games easy to market. I knew with all of that text that I wouldn't get many replies, but you pretty much covered everything, so thank you. The only problem I'm having is with the doors, though MMF has always had a way of having random quirky bugs that you have to make strange workarounds for.
Again, if anyone has any gameplay suggestions or can work with mmf2 or make 32 x 32 tile art, please contact me.