Оценить:
 Рейтинг: 0

Справочник Жаркова по проектированию и программированию искусственного интеллекта. Том 7: Программирование на Visual C# искусственного интеллекта. Издание 2

Год написания книги
2023
Теги
<< 1 ... 25 26 27 28 29 30 31 32 33 34 >>
На страницу:
29 из 34
Настройки чтения
Размер шрифта
Высота строк
Поля

breadRectangle.X = bx;

breadRectangle.Y = by;

//We check the collision of objects

//taking into account the tomatoes:

if (goingDown)

{

// only bounce if the cheese is going down

if (cheeseRectangle.IntersectsWith(breadRectangle))

{

//At the time of collision,

//the Beep signal is given:

Microsoft.VisualBasic.Interaction.Beep();

// we have a collision

bool rightIn = breadRectangle.Contains(

cheeseRectangle.Right,

cheeseRectangle.Bottom);

bool leftIn = breadRectangle.Contains(

cheeseRectangle.Left,

cheeseRectangle.Bottom);

// now deal with the bounce

if (rightIn & leftIn)

{

// bounce up

goingDown = false;

}

else

{

// bounce up

goingDown = false;

// now sort out horizontal bounce

if (rightIn)

{

goingRight = false;

}

if (leftIn)

{

goingRight = true;

}

}

}

}

else

{

// only destroy tomatoes of the cheese is going up

for (int i = 0; i < tomatoes.Length; i++)

{

if (!tomatoes[i].visible)

{

continue;

}
<< 1 ... 25 26 27 28 29 30 31 32 33 34 >>
На страницу:
29 из 34

Другие электронные книги автора Валерий Алексеевич Жарков