DaveMS

Members
  • Content count

    202
  • Joined

  • Last visited

Community Reputation

187 Neutral

About DaveMS

  • Rank
    Member
  1. Combat System for First Person RPG

    The combat system from Mount & blade or chivalry could work quite well. Left mouse button attacks - the swing direction depends on the direction of the enemy from the center of the player's screen. Right mouse blocks, which uses the same directional system.   I was thinking of building this combat system into a first person fantasy rpg myself when I get around to starting it. 
  2. Python Help

    [quote name='Sx2Kirby' timestamp='1318622791' post='4872651'] Hello, I've been getting into python and reading a book to get used to it, but I'm having some trouble understanding a part about while loops. [code] done = False while not(done): quit = input("Do you want to quit? ") if quit == "y": done = True; attack = input("Does your elf attach the dragon?") if attack == "y" : print ( " Bad choice , you died . " ) done = True ; [/code] Whenever I input anything into quit it just says that it wasn't defined, and when I try defining y like : y = "y" or something it doesn't actually quit. And this is straight from the book I am learning from. And also, what books or tutorials would you recommend? [/quote] I'm not a python man, but I done a bit of reading around your problem. Look like Input() expects a python expression to be entered as input to be evaluated. I think the function you want to use for general input from a user is raw_input(). Input() : [url="http://docs.python.org/library/functions.html#input"]http://docs.python.org/library/functions.html#input[/url] raw_input(): [url="http://docs.python.org/library/functions.html#raw_input"]http://docs.python.org/library/functions.html#raw_input[/url]
  3. SDL Co-ordinates

    [quote name='ravinDavin' timestamp='1318614989' post='4872610'] The way I remember the Y direction is: [quote] A girl goes [b]down[/b] in front of you = positive [/quote] [/quote] lol
  4. Is my Design "Too much inheritance?"

    Just going to pick out one of the questions in your OP. "Should I make separate classes for weapon / power-up types?" I would make separate classes for objects which require different behaviour. If the only difference between then is different properties, then no seperate classes are required. I wouldn't make separate classes for weapons - what is the difference between weapons? Fire rate, max ammo, bullet type? These should be fields in the weapon class, and the values of these should be different for each weapon. The class can have the methods your would expect from a weapon class eg. Fire() - Check if enough ammo, create a bullet of the type specified in the bullet_type field at the players position, reduce ammo by 1. Power-ups - I would go for separate classes for these - A base powerup class, with a virtual OnPickup() method. A derived class for each powerup could implement the OnPickup() method where the effects of the powerup are implemented. Bullets - I think the same as powerups, a separate class for each type. Base bullet class, with virtual methods such as Update(), OnHit(). Maybe one type of bullet follows a straight line when fired, another follows a sine wave type movement. These can be implemented in the update function of each specific bullet class. The OnHit() method could be different for each type of bullet. Maybe one type of bullet makes a small explosion when it hits on enemy. Another type splits into several smaller bullets when it hits an enemy. Only my initial ideas - as always, there is more than one way to approach the problem.
  5. Help with jumping

    Your going to have to help us to help you - your not making it easy for the people trying to help you. Rather than posting your code in a zip file, post it directly on the forum, most people are not going to be bothered to download and compile your source - they will just move onto the next post. Second, you need to tell us why it isn't working. give us a walk through of what you think should be happening, then tell us what is actually happening. give us error messages. Third, programming isn't about writing code - that is the end product, the job of a programmer is problem solving. Tell me in english how you would make the character jump. If you can't do that, then your not going to be able to tell the computer how to do it in code.
  6. Help with jumping

    For jumping / falling, try adding a downwards acceleration to your character when it is not on top of a platform. Jumping can be done by adding an upwards force when the jump button is pressed. If you post your errors, we can help you with them.
  7. Your names could be saved in the file as Dire_Wolf. Then simply remove any "_" in strings you find as you are parsing your text file, and insert a space. Do the opposite when saving to file.
  8. How to Plan? What to code first?

    I programmed a poker bot for one of my university projects. It could hook onto an online poker client, read the state of the game through a combination of pixel matching and OCR, and then used ANNs and targeted simulations to decide on the best action to take, and then click the appropriate button on screen. It took me about 3 months of programming to get it done. Once I finished university, I decided to create a newer better poker bot. It was going to be amazing. This version would have a database to store previous hand histories, which could be used to create an individual ANN for each opponent it met, improving the accuracy of the opponent modelling. It would have a bot simulator, where bots could play each other at 500 hands a second, producing a nice graph and all the statistics you could need to see where their weaknesses / strengths were. I spent the next 3 months designing it all. Classes, databases, all perfectly designed adhering to OO principles. Then I started coding. Despite all my planning, problems popped up that I hadn't foreseen. No problem though, I'll just do a bit of a redesign. Designs were changed, classes removed, added, amended. Carry on coding. More problems. More redesigns. In the end I spent more time designing than I did coding. It has been more than a year now, and my poker bot has less than half the functionality that my 3 month uni project had. I don't spend a huge amount of time programming - I have other responsibilities nowadays that I didn't have when I was a student - job, baby etc, but I think the real problem isn't lack of time, it is lack of motivation. I have spent so much time on the project, but have barely anything to show for it. My advise - don't worry about design very much at all. Have a quick think about how the main parts will work together, and start coding. Dont worry about needing to rewrite code when things go wrong. The most important thing is to get coding and get something working to keep you motivated. Better a working program with terrible source code, than a great design and no program.
  9. What games would you most like a clone of?

    And dungeon keeper 3 - what happened to that? Why do all the games I love get cancelled? Still - lots to look forward to. Battlefield 3, Counterstrike: GO, Elder Scrolls V. Going to be a good 6 months me thinks.
  10. What games would you most like a clone of?

    +1 for an ultima online sequel. Was not impressed when they cancelled development of UO2. Although if it is to be done, it needs to be like the early days of UO - with PvP everywhere and full loot, not the terrible game that it has become today.
  11. A planet made of diamonds!

    Isn't the value of diamond based on it's (or supposed) rarity? Surely mining and dragging the whole thing back to earth would provide an abundance of diamond, thereby reducing it's value? It would probably cost more money to make the trip, than profit you would generate from it.
  12. What do you think about the Revelation?

    I think about it no more than I think about any other religious text that has been written in the last few thousand years - I don't give it much thought at all. If there is a god up there, which I highly doubt, I'm sure he doesn't give a toss about organised man made religions. If he has created the billions of galaxies in the universe, hundreds of billions of planets -I can't imagine him hovering over us insignificant humans screaming "no.. no.. NOO!... No red meat on Fridays!" If he really is sat up there waiting to judge - who is he going to let in to heaven - someone like me who has lived (up until now anyway) a relatively good life, compassionate and caring, but doesn't believe in him. Or will it be the militant christian - firebombed an abortion clinic in his name, but believes in him without question. If it is the latter, I would rather be elsewhere anyway.
  13. C# Calcuator Help

    I should also point out in the above code, there is a possible problem - if the user clicks the equals button without choosing an operation to perform - op will be unassigned. But hey, I did warn you it was untested
  14. C# Calcuator Help

    [quote name='Key' timestamp='1311025105' post='4837049'] Thanks Dave, that really helped. So I got it to calculate correctly, but what if I were to do subtraction? The way I currently have it setup is that when the user presses equal the two variables are added. How can I make it so that if the addition sign was clicked it does addition and same for subtraction? -Edit- So I attempted it myself, but now I'm wondering is there a more efficient way of doing this? [code]using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace Calculator { public partial class Calculator : Form { double variableOne, variableTwo, answer; bool addition, subtraction, multiplication, division; public Calculator() { InitializeComponent(); } private void fieldOne_TextChanged(object sender, EventArgs e) { } private void Clear_Click(object sender, EventArgs e) { fieldOne.Clear(); fieldOne.Focus(); } private void Addition_Click(object sender, EventArgs e) { double.TryParse(fieldOne.Text, out variableOne); fieldOne.Clear(); fieldOne.Focus(); addition = true; } private void Subtraction_Click(object sender, EventArgs e) { double.TryParse(fieldOne.Text, out variableOne); fieldOne.Clear(); fieldOne.Focus(); subtraction = true; } private void Multiplication_Click(object sender, EventArgs e) { double.TryParse(fieldOne.Text, out variableOne); fieldOne.Clear(); fieldOne.Focus(); multiplication = true; } private void Division_Click(object sender, EventArgs e) { double.TryParse(fieldOne.Text, out variableOne); fieldOne.Clear(); fieldOne.Focus(); division = true; } private void Equals_Click(object sender, EventArgs e) { double.TryParse(fieldOne.Text, out variableTwo); fieldOne.Clear(); fieldOne.Focus(); if (addition == true) { answer = variableOne + variableTwo; addition = false; } if (subtraction == true) { answer = variableOne - variableTwo; subtraction = false; } if (multiplication == true) { answer = variableOne * variableTwo; multiplication = false; } if (division == true) { answer = variableOne / variableTwo; division = false; } string a = answer.ToString(); fieldOne.Text = a; } } } [/code] [/quote] One thing i've learnt in the few years i'v been programming - there are [i]always[/i] more efficient ways of doing it. The most important thing is that it works. If you want to try it though - you can use a delegate as a function pointer, ie - the function to be called can be set at runtime. Code incoming - not tested. [code] namespace Calculator { public class OperatorFunctions { public delegate double OperatorDelegate(double n1, double n2); // here we declare a delegate function, which has a return type of double, and requires 2 doubles as parameters. We will use it to reference one of the functions below. public static double Addition(double num1, double num2) { return num1 + num2; } public static double Subtraction(double num1, double num2) { return num1 - num2; } public static double Multiplication(double num1, double num2) { return num1 * num2; } public static double Division(double num1, double num2) { return num1 / num2; } } public partial class Calculator : Form { double variableOne, variableTwo, answer; OperatorFunctions.OperatorDelegate op; // here is our delegate object. it will hold a reference to one of the operator methods, although we don't know which one yet. public Calculator() { InitializeComponent(); } private void ClearAndFocus() { fieldOne.Clear(); fieldOne.Focus(); } private void Clear_Click(object sender, EventArgs e) { ClearAndFocus(); } private void Addition_Click(object sender, EventArgs e) { double.TryParse(fieldOne.Text, out variableOne); ClearAndFocus(); op = OperatorFunctions.Addition; // the delegate object op now stores a reference to the addition method } private void Subtraction_Click(object sender, EventArgs e) { double.TryParse(fieldOne.Text, out variableOne); ClearAndFocus(); op = OperatorFunctions.Subtraction; // the delegate object op now stores a reference to the subtraction method } private void Multiplication_Click(object sender, EventArgs e) { double.TryParse(fieldOne.Text, out variableOne); ClearAndFocus(); op = OperatorFunctions.Multiplication; // the delegate object op now stores a reference to the multiplication method } private void Division_Click(object sender, EventArgs e) { double.TryParse(fieldOne.Text, out variableOne); ClearAndFocus(); op = OperatorFunctions.Division; // the delegate object op now stores a reference to the division method } private void Equals_Click(object sender, EventArgs e) { double.TryParse(fieldOne.Text, out variableTwo); ClearAndFocus(); answer = op(variableOne, variableTwo); // we are now going to invoke the method referenced by this delegate object. But which method is it? Beats me, but we know it takes 2 doubles as parameters, and returns a double. fieldOne.Text = answer.ToString(); } } } [/code]
  15. C# Calcuator Help

    And to add to my previous post I'm not too clear on your logic. When do you expect variableOne to be read from the text box? The way I would do it: User insert value into fieldOne. User clicks addition button program reads value from fieldOne, puts into variableOne, clears fieldOne User inserts second value into fieldOne User clicks Equals button program reads value from fieldOne, puts into variableTwo, clears fieldOne program calculates answer program inserts answer into fieldOne