Sorry, this is a very noob question. I'm a fresh c++ student...
I am trying to understand a c++ code I found online for a space shooter like game. I want to use it for my project. The hero shoots arrows to an enemy. It has this &ss, ss.X and !ss but I don't know what they mean. What does the . between variables mean? And what does &ss mean? Would you please share any topic or lesson related to this? Or do you know what term these are called? I'm trying to search it on google, but I don't know the right keyword.
This is when the monster hits the hero. This is a function inside a class of my monster.
class monster
{
private:
int x;
int y;
public:
int X() { return x; }
int Y() { return y; }
void Collision(Hero &ss)
{
if(((x >= ss.X()) && (x <= ss.X() + 5)) && ((y >= ss.Y()) && (y <= ss.Y() + 2)))
{
ss.Damage(); //a function under my hero class which will decrease hero energy
gotoxy(x,y); printf(" ");
x = rand()%74 + 3;
y = 4;
}
}
Thank you!