1

yeah, I'm gonna post a little bit of sourcecode that I made here. if anyone can help me. here is y struggle. spawn_mine is not working when in fact it is made already. could you help? thanks in advance.
[email protected][]mines(0);
class mine
{
int x;
int y;
mine(int mx,int my)
{
x=mx;
y=my;
}
void spawn_mine(int x, int y)
{
mine m1(x, y);
mines.insert_last(m1);
}
}

blindness is an ability. not a disability.

Thumbs up

2

and here is the line of source that is not working.
spawn_mine(me.x,me.y);
thanks again!

blindness is an ability. not a disability.

Thumbs up

3

This is happening because spawn_mine is defined inside the mine class. If you want to call it globally you have to keep spawn_mine(); outside the class definition. So you would do like this
[email protected][] mines(0);
class mine
{
int x, y;
mine(int mx, int my)
{
x=mx;
y=my;
}
}
void spawn_mine(int x, int y)
{
mine m1(x, y);
mines.insert_last(m1);
}

If you want to get in touch with me you can follow me on Twitter
have a nice day.
Paul

Thumbs up +1

4

aha! thanks!

blindness is an ability. not a disability.

Thumbs up

5

that's the concept of scope, which I am not qualified to explain properly, but I'm sure others here are.

The bipeds think this place belongs to them, how cute.

Thumbs up

6

hi, new problem, on line 82 in zombie.bgt, if(zombiesleft bracketiright bracket.x==minesleft bracketiright bracket.x)
description: index out of bounds. if someone can help that would be great. you can look at the source of the mine.bgt class in post 2, if there's a problem in that, let me know, if not then I will post the zombie.bgt class up here too.
also the reason I put left bracket and right bracket is because the forum doesn't let me put those punctuation marks, do not know why.

blindness is an ability. not a disability.

Thumbs up

7

I don't understand what all this bracketiright stuff is in the if statement. I'm guessing either you or the foroum software might have converted it, but if that's not the case, that can't be there. Index out of bounds means that your code is trying to access something in an array outside of what the array currently contains. That's something it cannot do, so throws an error, but I think you probably already knew that. To learn more it would be necessary to see what's writing to that array and when.

Just in case you didn't know, if statements are meant to contain expressions to test so if (var == var2) if (var != var 2) and all your less than, greater than, less or equals, greater or equal, and all that stuff.

The bipeds think this place belongs to them, how cute.

Thumbs up

8 (edited by rory-games 2018-10-10 10:37:29)

hi all. so today I got this weird bug, where when I am at the objects x it still won't let me grab him! please help! the sound is sounding like it is coming from right in front of me.

blindness is an ability. not a disability.

Thumbs up

9

We can't really help with just that...

Sincerely,
Lucas.

Thumbs up

10

actually I think I know what the problem is, fixing now.

blindness is an ability. not a disability.

Thumbs up