Пользователь
Регистрация: 11.09.2018
Сообщений: 20
|
Не заменяет изображение в окне в игре в паскаль!
Короче, нужно сделать так, чтобы по нажатию на кнопку "Играть", то запускалась игра. Я пытался, но никак, обработка нажатий в procedure MouseUp!
procedure game это сама игра, ну изображения там, кнопки!
Моя первая игра, понимаю так сяк!
Объясните прошу максимально подробно!
Код:
program gameCLICK;
uses GraphABC,Utils;
var fon,click2,money,n,lvl:string;
fon1,click1,money1,b,lvl1:Picture;
r:integer;
menu1:boolean;
MNactive:boolean;
active1:boolean;
opcl:boolean;
pGold:integer:=0;
mon1:integer:=1;
mon2:integer:=10;
pLvl:integer:=0;
click:integer;
//улучшенния========
//улучшенния========
//Кликабельность=================
procedure MouseUp(x,y,mb:integer);
begin
//GOLD+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
if (mb=1) and (x > 300) and (x < 460) and (y > 400) and (y < 450) then
begin
randomize;
SetBrushColor(ClWhite);
SetFontColor(ClGold);
SetFontSize(20);
r:=random(mon1,mon2);
pGold:= pGold+r;
textout(170,40,pGold);
click:=click + 1;
pLvl:=click div 100;
SetBrushColor(ClNavy);
SetFontColor(ClWhite);
SetFontSize(21);
TextOut(256,1,PLvl);
SetbrushColor(clBlue);
SetFontSize(15);
TextOut(200,85,click);
end;
//GOLD+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
{//МАТРОС===================================================================
if (mb=1) and (x > 10) and (x < 100) and (y > 110) and (y < 140) then
begin
if pLvl >= 5 then
end;
//МАТРОС===================================================================}
//MENU=====================================================================
begin
if (mb=1) and (x > 0) and (x < 150) and (y > 0) and (y < 50) then
begin
end;
end;
//MENU=====================================================================
end;
procedure game(active:boolean);
begin
if active =true then
begin
LockDrawing;
//LOGO==LOGO========
n:='logo.jpg';
b:=Picture.Create(n);
b.Load(n);
b.Draw(672,0);
//LOGO==LOGO========
//Money=============
money:='money.png';
money1:=Picture.Create(money);
money1.Load(money);
money1.Draw(115,30);
//Money=============
//plvl
lvl:='lvl.jpg';
lvl1:=Picture.Create(lvl);
lvl1.Load(lvl);
lvl1.Draw(115,1);
//plvl
//Clicks========
click2:='Clicks.png';
click1:=Picture.Create(click2);
click1.Load(click2);
click1.Draw(115,85);
//Clicks========
//Улучшения=====================
SetBrushColor(Clwhite);
Rectangle(1,1,111,700);
SetFontColor(ClBlack);
SetFontStyle(fsBoldItalic);
SetFontSize(9);
TextOut(15,11,'УЛУЧШЕНИЯ');
SetBrushColor(ClGold);
line(1,40,110,40);
//=====================
Rectangle(10,70,100,100);
FillRect(10,70,100,100);
//=====================
Rectangle(10,110,100,140);
FillRect(10,110,100,140);
SetBrushColor(ClGold);
SetFontColor(ClBlack);
SetFontStyle(fsBoldItalic);
SetFontSize(6);
TextOut(17,120,'Нанять Матроса');
Rectangle(10,150,100,180);
FillRect(10,150,100,180);
SetBrushColor(ClGold);
SetFontColor(ClBlack);
SetFontStyle(fsBoldItalic);
SetFontSize(6);
TextOut(17,160,'Нанять Шкипера');
Rectangle(10,190,100,220);
FillRect(10,190,100,220);
SetBrushColor(ClGold);
SetFontColor(ClBlack);
SetFontStyle(fsBoldItalic);
SetFontSize(6);
TextOut(17,200,'Нанять Канонира');
Rectangle(10,230,100,260);
FillRect(10,230,100,260);
SetBrushColor(ClGold);
SetFontColor(ClBlack);
SetFontStyle(fsBoldItalic);
SetFontSize(6);
TextOut(17,240,'Нанять Рулевого');
Rectangle(10,270,100,300);
FillRect(10,270,100,300);
SetBrushColor(ClGold);
SetFontColor(ClBlack);
SetFontStyle(fsBoldItalic);
SetFontSize(6);
TextOut(17,280,'Нанять Боцмана');
Rectangle(10,310,100,340);
FillRect(10,310,100,340);
SetBrushColor(ClGold);
SetFontColor(ClBlack);
SetFontStyle(fsBoldItalic);
SetFontSize(6);
TextOut(17,320,'Нанять Старпома');
Rectangle(10,350,100,380);
FillRect(10,350,100,380);
SetBrushColor(ClGold);
SetFontColor(ClBlack);
SetFontStyle(fsBoldItalic);
SetFontSize(6);
TextOut(17,360,'Нанять Мейстера');
//Улучшения=====================
//Кнопка клика==================
SetBrushColor(ClBlack);
Rectangle(300,400,460,450);
SetBrushColor(ClBlack);
SetFontColor(ClGold);
SetFontStyle(fsBoldItalic);
SetFontSize(22);
TextOut(338,410,'GOLD');
//Кнопка клика==================
ReDraw;
end;
end;
procedure menu(MNactive:boolean);
begin
if MNactive = true then
begin
LockDrawing;
//FON==========================
fon:='FON.jpg';
fon1:=Picture.Create(fon);
fon1.Load(fon);
fon1.Draw(0,0);
//fon==========================
SetBrushColor(ClSkyBlue);
rectangle(0,0,150,50);
rectangle(0,52,150,101);
rectangle(0,103,150,152);
SetFontColor(ClNavy);
SetFontSize(19);
TextOut(34,10,'Играть');
//rectangle1
TextOut(7,60,'Как играть?');
//rectangle2
TextOut(34,110,'Выход');
//rectangle3
ReDraw;
end;
end;
begin
//=====Процедуры======
OnMouseUp:=MouseUp;
//=====Процедуры======
SetWindowTitle('PIRATE_CLICKER v1.1');
Setwindowsize(800,600);
menu1:=true;
menu(menu1);
end.
Последний раз редактировалось Roman_Jarckov23; 12.09.2018 в 21:45.
|