Search:

Type: Posts; User: Dondrei

Page 1 of 2 1 2

Search: Search took 0.01 seconds.

  1. Replies
    26
    Views
    4,456

    Aw, crap. I thought that just reserved 30 spaces....

    Aw, crap. I thought that just reserved 30 spaces.

    Hmm. You're right, I was eventually intending on making them local. What should I do when they're local?
  2. Replies
    26
    Views
    4,456

    Hmm, I have a new problem now, I was trying to...

    Hmm, I have a new problem now, I was trying to switch from using a vector of Monsters to using a vector of pointers to the Monsters like matsp suggested, but it doesn't like it. What I had originally...
  3. Replies
    7
    Views
    1,336

    Oh, that makes sense. Why would you want to...

    Oh, that makes sense.

    Why would you want to de-const a const? Doesn't that defeat the purpose?
  4. Replies
    7
    Views
    1,336

    Cool, thanks. What are the other kinds of...

    Cool, thanks.

    What are the other kinds of casts used for? Pointers or something?
  5. Replies
    7
    Views
    1,336

    Am I using casts properly?

    There are some pretty big gaps in my programming knowledge, one of them being casts. I was writing code like this:


    int a, c;
    float b;
    a = 100;
    b = 0.8;
    c = a*b;

    My compiler threw a...
  6. Replies
    26
    Views
    4,456

    Huh, so all those variables I've made ints and...

    Huh, so all those variables I've made ints and all the ones I've made signed ints are actually all the same? Now I feel like a dork. :P



    I see... so why does vector.size() need a specialised...
  7. Replies
    26
    Views
    4,456

    Okay, I think I see the problem, I was thinking...

    Okay, I think I see the problem, I was thinking int was unsigned but apparently it defaults to signed. That threw me. If I put:


    for (unsigned int i=0; i<MonsterList.size(); i++) {}

    It doesn't...
  8. Replies
    26
    Views
    4,456

    Even if I change "int i" to "signed int i" I...

    Even if I change "int i" to "signed int i" I still get comparison of signed and unsigned integer expressions. All the example code I've seen just uses something like:


    for(int i=0;i <...
  9. Replies
    26
    Views
    4,456

    Hmm, now I have an elementary question... I made...

    Hmm, now I have an elementary question... I made a loop for the two drawimage calls:


    for (int i=0; i<=1; i++) {
    drawimage(block, 0, 0, MonsterList.at(i).spritew,...
  10. Replies
    26
    Views
    4,456

    Oh, looks like you all figured it out right after...

    Oh, looks like you all figured it out right after I posted :P

    I'm planning to have different kinds of monsters, but Monster will be the base class, I think all the basic features of the monster...
  11. Replies
    26
    Views
    4,456

    Sorry... I'm a dork, I wasn't thinking clearly....

    Sorry... I'm a dork, I wasn't thinking clearly. The problem is that in my movement code I was still referring to Monster1 and Monster2, I should've changed that to MonsterList.at(0) and...
  12. Replies
    26
    Views
    4,456

    Gah... I think I figured it out. I went to copy...

    Gah... I think I figured it out. I went to copy more code across but then looking at it it occurred to me the monsters were assigned to the vector before I specified their positions. I pasted it just...
  13. Replies
    26
    Views
    4,456

    Vectors of classes

    I have a class Monster for NPCs and so on in the game, and I want to create a vector containing all the currently active monsters. As they die or get spawned I figure I'll pushback or popback them in...
  14. Replies
    5
    Views
    1,876

    Oh right, that makes sense. I was assuming that...

    Oh right, that makes sense. I was assuming that because the logic was being used in the definition of a float, it would assume all the numbers in it were floats too.

    So if I put (9.0/5) for...
  15. Replies
    5
    Views
    1,876

    Unexpected variable behaviour

    I'm still very much a programming newbie, so maybe this all makes perfect sense but it wasn't the behaviour I was expecting. I wrote a Celsius to Fahrenheit converter to show someone the basics of...
  16. Replies
    13
    Views
    2,780

    I think I'll just separate with &&s, probably the...

    I think I'll just separate with &&s, probably the simplest way.



    Ah, that makes sense.
  17. Replies
    13
    Views
    2,780

    Oh, okay. So what does the

    Oh, okay. So what does the <= operator do in that context?
  18. Replies
    13
    Views
    2,780

    Very elementary C++ question

    Okay, this is a bit basic but I'm having a hard time Googling it so what the hey...

    Does C++ accept logic tests like:


    if (a <= x <= y) {}

    Or do I have to keep writing it out as:
  19. Replies
    4
    Views
    1,906

    Yeah, my convention is basically just personal...

    Yeah, my convention is basically just personal aesthetics at the moment, I should probably make it more consistent.

    Heh, thanks for the link, I know exactly the sort of people it was talking...
  20. Replies
    4
    Views
    1,906

    Oh, I already had ==, I just got sloppy copying...

    Oh, I already had ==, I just got sloppy copying the code :P

    Hmm, maybe I should pass Goblin to the function instead, that would make the most sense I think.

    So if I make goblin and hero derived...
  21. Replies
    4
    Views
    1,906

    Basic scope issue

    I'm trying to access a variable in a class from another class:


    class hero (
    public:
    int xpos;
    void Move();
    );

    class monster (
  22. Replies
    12
    Views
    1,435

    Oh, of course, the scope thingy. That's great,...

    Oh, of course, the scope thingy.

    That's great, thanks for your help.
  23. Replies
    12
    Views
    1,435

    Ah, thanks. Hmm, I'm getting some kind of...

    Ah, thanks.

    Hmm, I'm getting some kind of error if I use this.xpos, but if I put this->xpos it seems to work, is "this" actually a pointer?

    Is there a way to change the global variable xpos...
  24. Replies
    12
    Views
    1,435

    Noob question about classes

    If I have a class defined like this:


    class Sprite {
    public:
    int xpos;
    int ypos;
    void move();
    };
  25. Replies
    5
    Views
    1,985

    I don't think so, I'm just hitting Dev-C++'s...

    I don't think so, I'm just hitting Dev-C++'s normal compile & run button. The thing is I'm putting in "include SDL.h" and apparently it references inttypes.h, so that's why I'm getting the error.
Results 1 to 25 of 26
Page 1 of 2 1 2