//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::lewoTimer(TObject *Sender)
{
pop->Left -= 10;
if (pop->Left <= 0 ) pop->Left = - pop->Left;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormKeyDown(TObject *Sender, WORD &Key,
TShiftState Shift)
{
if (Key == VK_LEFT) lewo->Enabled = true;
if (Key == VK_RIGHT) prawo->Enabled = true;
if (Key == VK_SPACE) skok->Enabled = true;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::prawoTimer(TObject *Sender)
{
pop->Left +=10 ;
pop->Left -=15;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormKeyUp(TObject *Sender, WORD &Key,
TShiftState Shift)
{
if (Key == VK_LEFT) lewo->Enabled = false;
if (Key == VK_RIGHT) prawo->Enabled = false;
if (Key == VK_SPACE) skok->Enabled = false;pop->Top -=10;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::skokTimer(TObject *Sender)
{
pop->Top -= 10;
}
//--------------------------------------------------------------------------
Witam , chciałem stworzyć grę 2d w borland cpp builder 6 pomyślałem ,że skoro można arkanoida można i zwykłą platformówkę , mam problem z opisaniem skoku , stworzyłem dodatkowy timer który zwiększa wysokość postaci (pop) ale nie mam pojęcia jak ustawić spadanie i jak moge oprogramować poruszanie się w powietrzu , kierunek skoku . Proszę o pomoc!