1. Post #1
    HQRSE FUCKER
    ief014's Avatar
    September 2009
    2,579 Posts
    All your not-thread-worthy questions here!

    Well? What do you need help with?
    Reply With Quote Edit / Delete Windows 7 Germany Show Events Programming King Programming King x 4Friendly Friendly x 2Dumb Dumb x 1 (list)

  2. Post #2
    Dennab
    February 2011
    732 Posts
    Is the .0 necessary
    Reply With Quote Edit / Delete Australia Show Events Agree Agree x 7Disagree Disagree x 2 (list)

  3. Post #3
    HQRSE FUCKER
    ief014's Avatar
    September 2009
    2,579 Posts
    Is the .0 necessary
    No
    Reply With Quote Edit / Delete Windows 7 Germany Show Events Funny x 24Disagree x 1Dumb x 1Zing x 1Agree x 1Informative x 1 (list)

  4. Post #4
    Paid for a title.
    Maurice's Avatar
    June 2005
    6,080 Posts
    I like the .0
    Reply With Quote Edit / Delete Windows 7 Germany Show Events Agree Agree x 11Disagree Disagree x 2Friendly Friendly x 1Informative Informative x 1 (list)

  5. Post #5
    slashsnemesis's Avatar
    July 2009
    4,895 Posts
    Repostin' from old thread
    Could somebody explain to me how I would use pygame.sprite.RenderPlain when working with multiple instances of the same class? I know renderplain is just like a group but that's all I know. I don't really know what groups are either.

    Multiple instances of the same class being like:
    Code:
    i = 0
    while i < difficulty * 10: #difficulty is set by the user as either 1 2 or 3
        food = Food(blah) #Just see this part as "create a new instance of Food class named food"
        #Renderplain stuff here?
    This has been a massive hurdle in my game developing for a while now and it would really be awesome if someone could get this out of my way.
    Reply With Quote Edit / Delete Windows XP United States Show Events

  6. Post #6
    A Self Condescending Title
    Xion12's Avatar
    October 2006
    2,097 Posts
    I'm going to work on my first XNA game, but first I need some good XNA tutorials. Anybody know of any good ones?
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  7. Post #7
    Der FΓΌhrer
    Quark:'s Avatar
    January 2011
    3,154 Posts
    Is the .0 necessary
    It makes the OP look smarter
    Reply With Quote Edit / Delete Windows XP United States Show Events Programming King Programming King x 13 (list)

  8. Post #8
    Richy19's Avatar
    May 2010
    4,851 Posts
    I'm going to work on my first XNA game, but first I need some good XNA tutorials. Anybody know of any good ones?
    http://www.riemers.net/


    If i have a get method in C++, what would be the best way to use it
    As in how would i return a reference and not a copy?

    would it be like:

    Class myClass;
    
    public Class getMyClass()
    {
            return &myClass;
    }
    
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events Friendly Friendly x 1 (list)

  9. Post #9
    Gold Member
    Z_guy's Avatar
    July 2005
    466 Posts
    If i have a get method in C++, what would be the best way to use it
    As in how would i return a reference and not a copy?
    Class &getMyClass()
    {
      return myClass;
    }
    
    Reply With Quote Edit / Delete Windows 7 Sweden Show Events Funny Funny x 2Agree Agree x 1 (list)

  10. Post #10
    Gold Member
    Jawalt's Avatar
    August 2007
    3,372 Posts
    Is the .0 necessary
    He was making sure the compiler knew it was a double.
    Reply With Quote Edit / Delete Windows 7 United States Show Events Agree Agree x 11Zing Zing x 2 (list)

  11. Post #11
    DevBug's Avatar
    July 2010
    1,044 Posts
    -snip-
    Reply With Quote Edit / Delete Linux Canada Show Events

  12. Post #12
    Phyxius's Avatar
    January 2009
    436 Posts
    Could someone give me some pseudocode (or C# if you're feeling generous) that would rotate point at x,y around point at a,b n degrees? I've been hacking at this for a while and any implementation I try wigs out at anything other than 180 degrees.
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  13. Post #13
    HQRSE FUCKER
    ief014's Avatar
    September 2009
    2,579 Posts
    Could someone give me some pseudocode (or C# if you're feeling generous) that would rotate point at x,y around point at a,b n degrees? I've been hacking at this for a while and any implementation I try wigs out at anything other than 180 degrees.
    By rotate around {a,b} you mean simply circle around it?
    Reply With Quote Edit / Delete Windows 7 Germany Show Events

  14. Post #14
    Phyxius's Avatar
    January 2009
    436 Posts
    Yep.
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  15. Post #15
    Map in a box's Avatar
    July 2009
    5,801 Posts
    Where does XNA redistributable install to?
    Reply With Quote Edit / Delete Windows XP United States Show Events Dumb Dumb x 1 (list)

  16. Post #16
    HQRSE FUCKER
    ief014's Avatar
    September 2009
    2,579 Posts
    Just a little trig.

    Simple example with SFML
    Code:
    using System;
    
    using SFML;
    using SFML.Graphics;
    using SFML.Window;
    
    namespace XYABRotation
    {
    	class Program
    	{
    		static void Main(string[] args)
    		{
    			Program pgm = new Program();
    		}
    
    		RenderWindow rw;
    
    		/// <param name="v">Value in degrees</param>
    		/// <returns>Returns Sin of the degree</returns>
    		static float sind(float v)
    		{
    			return (float)Math.Sin(v / 180d * Math.PI); //Math.Sin uses radians... convert from degrees
    		}
    
    		/// <param name="v">Value in degrees</param>
    		/// <returns>Returns Cos of the degree</returns>
    		static float cosd(float v)
    		{
    			return (float)Math.Cos(v / 180d * Math.PI); //convert from degrees like Sin()
    		}
    
    		public Program()
    		{
    			rw = new RenderWindow(new VideoMode(640, 480), "Rotate", Styles.Close, new ContextSettings(24, 8));
    			rw.Closed += new EventHandler(rw_Closed);
    
    			Vector2 AB = new Vector2(rw.Width/2, rw.Height/2);
    			Vector2 XY = new Vector2(); //this point will rotate around AB
    
    			float degrees = 0.0f;
    			float distance = 40.0f; //XY will be 40 pixels in distance from AB
    			while (rw.IsOpened())
    			{
    				rw.DispatchEvents();
    
    				XY.X = sind(degrees) * distance + AB.X;
    				XY.Y = cosd(degrees) * distance + AB.Y;
    
    				degrees += 0.05f;
    
    				rw.Clear();
    
    				rw.Draw(Shape.Circle(AB, 5f, Color.Red));
    				rw.Draw(Shape.Circle(XY, 5f, Color.Green));
    
    				rw.Display();
    			}
    		}
    
    		void rw_Closed(object sender, EventArgs e)
    		{
    			rw.Close();
    		}
    
    	}
    }

    Edit

    I just realized it should be "//Math.Sin uses radians... convert from degrees", not "to"
    Reply With Quote Edit / Delete Windows 7 Germany Show Events

  17. Post #17
    Phyxius's Avatar
    January 2009
    436 Posts
    Thanks! That worked.
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  18. Post #18
    HQRSE FUCKER
    ief014's Avatar
    September 2009
    2,579 Posts
    Where does XNA redistributable install to?
    C:\Program Files (x86)\Microsoft XNA

    ?
    Reply With Quote Edit / Delete Windows 7 Germany Show Events Disagree Disagree x 2 (list)

  19. Post #19
    MadPro119's Avatar
    January 2010
    5,482 Posts
    Im very new to C# and have a quick question.

    Why would you use a random class (rand thingie) when you can use randomizer.Next

    I really don't understand the whole random class thing truthfully.
    Reply With Quote Edit / Delete Windows XP United States Show Events

  20. Post #20
    Gold Member
    Ortzinator's Avatar
    May 2005
    1,645 Posts
    Im very new to C# and have a quick question.

    Why would you use a random class (rand thingie) when you can use randomizer.Next

    I really don't understand the whole random class thing truthfully.
    Example?
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  21. Post #21
    Phyxius's Avatar
    January 2009
    436 Posts
    Im very new to C# and have a quick question.

    Why would you use a random class (rand thingie) when you can use randomizer.Next

    I really don't understand the whole random class thing truthfully.
    Random class lets you use a specific seed, so you can have a repeatable sequence of numbers.
    For instance, if you were randomly generating terrain, you could save the seed and regenerate the terrain each time it is loaded, saving tons of space for the save file.
    Reply With Quote Edit / Delete Windows 7 United States Show Events Useful Useful x 1Informative Informative x 1 (list)

  22. Post #22
    MadPro119's Avatar
    January 2010
    5,482 Posts
    Thanks both of ya, ended up figuring it out and now have a new quick question.

    I have a really simple console program I'm working with here. I wanted to it randomly generated numbers until it hit 119 at which point it would output a message.

    Code:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    
    namespace ConsoleApplication1
    {
        class Program
        {
            static void Main(string[] args)
            {
                int chance;
                Random rand;
                rand = new Random();
                A:chance = rand.Next(5, 200);
                Console.WriteLine(chance);
                Console.ReadLine();
                if (chance == 119)
                {
                    Console.WriteLine("Boom, 119 oh yah");
                    Console.ReadLine();
                    
                }
                else
                {
                    goto A;
                }
            }
        }
    }
    However upon going to A: it waits for the user to input something/ press enter. Anyway to make it automatically continue?
    Reply With Quote Edit / Delete Windows XP United States Show Events

  23. Post #23
    Gold Member
    Darwin226's Avatar
    January 2009
    3,458 Posts
    Don't use Console.ReadLine()? Lol.
    What did you think it would do?
    Reply With Quote Edit / Delete Windows 7 Croatia Show Events Informative Informative x 1 (list)

  24. Post #24
    Dennab
    February 2011
    732 Posts
    Thanks both of ya, ended up figuring it out and now have a new quick question.

    I have a really simple console program I'm working with here. I wanted to it randomly generated numbers until it hit 119 at which point it would output a message.

    Code:
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    
    namespace ConsoleApplication1
    {
        class Program
        {
            static void Main(string[] args)
            {
                int chance;
                Random rand;
                rand = new Random();
                A:chance = rand.Next(5, 200);
                Console.WriteLine(chance);
                Console.ReadLine();
                if (chance == 119)
                {
                    Console.WriteLine("Boom, 119 oh yah");
                    Console.ReadLine();
                    
                }
                else
                {
                    goto A;
                }
            }
        }
    }
    However upon going to A: it waits for the user to input something/ press enter. Anyway to make it automatically continue?
    don't use goto
    Reply With Quote Edit / Delete Mac Australia Show Events Agree Agree x 4 (list)

  25. Post #25
    MadPro119's Avatar
    January 2010
    5,482 Posts
    Don't use Console.ReadLine()? Lol.
    What did you think it would do?
    Oh fuck. You are right. This all makes sense now. I was confused about Console.ReadLine from the start. Now it makes sense, its reading the user input line becuase it is blank?

    Haha set the program to the same odds of winning the jackpot of the mega millions lottery. This should be fun.
    Reply With Quote Edit / Delete Windows XP United States Show Events

  26. Post #26
    Gold Member
    Darwin226's Avatar
    January 2009
    3,458 Posts
    Indeed. ReadLine just waits until you type something and press enter.
    Reply With Quote Edit / Delete Windows 7 Croatia Show Events Informative Informative x 1 (list)

  27. Post #27
    Icedshot's Avatar
    April 2010
    2,044 Posts
    don't use goto
    Goto isn't just pure evil, you know. I mean it clearly isn't the best option in this case, but it annoys me when people go "Language construct X, Y and Z should never, ever be used just because."
    Reply With Quote Edit / Delete Windows Vista United Kingdom Show Events Agree Agree x 8Dumb Dumb x 1 (list)

  28. Post #28

    January 2010
    94 Posts
    I have a problem with my python script, any idea why this isn't printing the last line?

    Code:
    print("hello and welcome to my test game")
    print("defining food... Done")
    fruit = 'apple '
    meat = 'beef '
    cheese = 'cheddar '
    vegetable = 'asparagus'
    print ('Combining Foods...')
    print fruit + meat
    print fruit + cheese
    print fruit + vegetable
    print fruit + fruit
    print('Done!')
    creation = raw_input('What do you want to create? ')
    print "creating", creation 
    print "would you like to store the", creation, "?"
    print "to store the pie, type one. to throw away the", creation, "type 2."
    decision = input("What do you want to do? ")
    if decision == 1:
        creation = "you have created nothing."
    else:
        print "you kept the", creation
    the last line, you kept the creation, doesn't print in any situation.
    Reply With Quote Edit / Delete Windows Vista Australia Show Events

  29. Post #29
    Dennab
    February 2011
    732 Posts
    Goto isn't just pure evil, you know. I mean it clearly isn't the best option in this case, but it annoys me when people go "Language construct X, Y and Z should never, ever be used just because."
    in most cases, goto is not necessary and makes the code hard to follow
    Reply With Quote Edit / Delete Mac Australia Show Events Agree Agree x 6Dumb Dumb x 1 (list)

  30. Post #30
    ProtractorNinja's Avatar
    May 2010
    186 Posts
    I have a problem with my python script, any idea why this isn't printing the last line?
    -snippity-
    the last line, you kept the creation, doesn't print in any situation.
    I'm not big on Python, but hopefully this will help.

    The input() method is used for taking in python expressions, not flat user input. Even with raw_input(), though, you're not going to get a numeric value for what the user types in; raw_input() only returns a string. You'll either have to convert whatever the result is into a number with int() and check that, or compare the string directly, i.e. use 'if decision == "1"'
    Reply With Quote Edit / Delete Windows Vista United States Show Events

  31. Post #31
    Slaaf van EternalFlamez.Ik wilde heel graag de laatste Indie Bundle, en ik kreeg deze kuttitel er gratis bij.
    Staneh's Avatar
    March 2010
    3,977 Posts
    I want to make a jumping system for my game, and I have basic gravity, a force pushing down the player. But, I want it, so if you press spacebar, it does a full jump, and not if you hold spacebar, it just keeps going up.
    Reply With Quote Edit / Delete Windows 7 Netherlands Show Events

  32. Post #32
    Richy19's Avatar
    May 2010
    4,851 Posts
    if player is on floor
    can jump = true
    else
    can jump = false
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events Agree Agree x 1Useful Useful x 1 (list)

  33. Post #33
    calzoneman's Avatar
    February 2008
    449 Posts
    I have a question related to Box2D. I'm trying to make the current object follow the mouse while the mouse button is held down such that it is unaffected by gravity but can still collide with other things. My b2World's gravity vector is set to (0.f, -9.81f). If I do this:

    b2Vec2 magnitude(0.f, 9.81f);
    object->ApplyForce(magnitude, object->GetWorldCenter());
    

    Then it gradually floats upward relative to the mouse cursor and when I release the mousebutton it flies up. If I manually set the position of the object each tick but don't apply an upward force, the same phenomenon happens but downward (it gradually sinks and then when I let go it flies into the ground). How can I effectively cancel out the gravity acting on a single object (b2Body) while still being able to set the position of the object to follow the mouse?

    Edit: What happened to the cpp tags?
    Edit: Never mind
    Reply With Quote Edit / Delete Windows Vista United States Show Events

  34. Post #34
    Samuka97's Avatar
    April 2007
    1,982 Posts
    I'm working on a todo-list application (C++ on C::B with SFML2) and I have a question: what's the best way to save the name of the task? Right now I have a "Task" class that has all of it's properties + a string named "name", however, to draw text on the screen with SFML it has to be a sf::string.

    So, should I keep a unique sf::string that I change everytime I'm gonna draw a task or should each task object have a sf::string of it's own?
    Reply With Quote Edit / Delete Windows 7 Brazil Show Events

  35. Post #35
    Richy19's Avatar
    May 2010
    4,851 Posts
    I'm working on a todo-list application (C++ on C::B with SFML2) and I have a question: what's the best way to save the name of the task? Right now I have a "Task" class that has all of it's properties + a string named "name", however, to draw text on the screen with SFML it has to be a sf::string.

    So, should I keep a unique sf::string that I change everytime I'm gonna draw a task or should each task object have a sf::string of it's own?
    Just make each task have a string of its own

    Edited:

    Dont know if anyone has used mogre but im trying to load a plain sphere
    when ever i do this tho i get
    External component has thrown an exception
    using Mogre;
    using Mogre.TutorialFramework;
    using System;
    
    namespace Mogre.Tutorials
    {
        class Tutorial : BaseApplication
        {
            public static void Main()
            {
                new Tutorial().Go();
            }
     
            protected override void CreateScene()
            {
                mSceneMgr.AmbientLight = new ColourValue(1, 1, 1);
    
                Entity ent = mSceneMgr.CreateEntity("sphere", "SphereCus.mesh");
                SceneNode node = mSceneMgr.RootSceneNode.CreateChildSceneNode("HeadNode");
                node.AttachObject(ent);
            }
        }
    }

    I have tried both my own meshes (simple sphere exported with blender) and te spheres that come with Mogre
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events

  36. Post #36
    Samuka97's Avatar
    April 2007
    1,982 Posts
    Alright. But now I get an error when trying to load the font from a file :saddowns:
    sf::Font fnt_task_name;
        if (!fnt_task_name.LoadFromFile("arial.ttf", 20))
        {
            return 1;
        }
    error: no matching function for call to 'sf::Font::LoadFromFile(const char [10], int)

    Edited:

    Oh. The new LoadFromFile function is not supposed to get a second argument now.
    Reply With Quote Edit / Delete Windows 7 Brazil Show Events

  37. Post #37
    Gold Member
    Dragonblz's Avatar
    October 2005
    1,181 Posts
    C#

    What's the best way to store a list of unicode characters in human readable format? I have my characters in a string delimited by semicolons, but that doesn't really work with invisible and control characters (their effects still take place), so I want to store them in a good format (ideally stored as \u, \x, etc).
    Reply With Quote Edit / Delete Windows 7 United States Show Events

  38. Post #38
    Richy19's Avatar
    May 2010
    4,851 Posts
    C#

    What's the best way to store a list of unicode characters in human readable format? I have my characters in a string delimited by semicolons, but that doesn't really work with invisible and control characters (their effects still take place), so I want to store them in a good format (ideally stored as \u, \x, etc).
    Not really sure what you mean, but cant you just use a list of chars?
    List<char> myCharList;

    or a char array?
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events

  39. Post #39
    ASK ME ABOUT MY PLAYBOOK INSTEAD OF COLLEGE
    icantread49's Avatar
    April 2011
    1,610 Posts
    I feel like WDYNHW is unsuccessful because a large # of good programmers only visit WAYWO, anyone agree

    like i think questions should just go in WAYWO, not only is it relevant but there is a higher chance of it being answered
    Reply With Quote Edit / Delete Windows XP United States Show Events Disagree Disagree x 3 (list)

  40. Post #40
    Richy19's Avatar
    May 2010
    4,851 Posts
    I feel like WDYNHW is unsuccessful because a large # of good programmers only visit WAYWO, anyone agree

    like i think questions should just go in WAYWO, not only is it relevant but there is a higher chance of it being answered
    I agree with most people only check the WAYWO thread, but i dont think everything should go in it
    Reply With Quote Edit / Delete Windows 7 United Kingdom Show Events