本文整理汇总了C++中SetY函数的典型用法代码示例。如果您正苦于以下问题:C++ SetY函数的具体用法?C++ SetY怎么用?C++ SetY使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了SetY函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
void Game_Vehicle::LoadSystemSettings() {
switch (type) {
case None:
break;
case Boat:
SetSpriteName(Data::system.boat_name);
SetSpriteIndex(Data::system.boat_index);
bgm = Data::system.boat_music;
SetMapId(Data::treemap.start.boat_map_id);
SetX(Data::treemap.start.boat_x);
SetY(Data::treemap.start.boat_y);
break;
case Ship:
SetSpriteName(Data::system.ship_name);
SetSpriteIndex(Data::system.ship_index);
bgm = Data::system.ship_music;
SetMapId(Data::treemap.start.ship_map_id);
SetX(Data::treemap.start.ship_x);
SetY(Data::treemap.start.ship_y);
break;
case Airship:
SetSpriteName(Data::system.airship_name);
SetSpriteIndex(Data::system.airship_index);
bgm = Data::system.airship_music;
SetMapId(Data::treemap.start.airship_map_id);
SetX(Data::treemap.start.airship_x);
SetY(Data::treemap.start.airship_y);
break;
}
}
示例2: SetX
void Window_Base::UpdateMovement() {
if (!IsMovementActive()) {
return;
}
current_frame++;
if (IsMovementActive()) {
SetX(old_position[0] + (new_position[0] - old_position[0]) * current_frame / total_frames);
SetY(old_position[1] + (new_position[1] - old_position[1]) * current_frame / total_frames);
} else {
SetX(new_position[0]);
SetY(new_position[1]);
}
}
示例3: SetX
void NaGeVector3D::operator /= (const double &scalar)
{
if(!IsNull())
{
SetX(GetX()/scalar);
SetY(GetY()/scalar);
SetZ(GetZ()/scalar);
}
else
{
SetX(0);
SetY(0);
SetZ(0);
}
}
示例4: SetName
Character::Character(std::string fromString) {
std::vector<std::string> tokens = utils::Tokenfy(fromString, '|');
if (tokens[0] == "PLAYER_OBJECT") {
SetName(tokens[57]);
SetLastname(tokens[58]);
SetRace(tokens[59]);
SetGender(tokens[60]);
SetFace(tokens[61]);
SetSkin(tokens[62]);
SetZone(tokens[63]);
SetLevel(std::stoi(tokens[64]));
SetHp(std::stoi(tokens[65]));
SetMaxHp(std::stoi(tokens[66]));
SetBp(std::stoi(tokens[67]));
SetMaxBp(std::stoi(tokens[68]));
SetMp(std::stoi(tokens[69]));
SetMaxMp(std::stoi(tokens[70]));
SetEp(std::stoi(tokens[71]));
SetMaxEp(std::stoi(tokens[72]));
SetStrength(std::stoi(tokens[73]));
SetConstitution(std::stoi(tokens[74]));
SetIntelligence(std::stoi(tokens[75]));
SetDexterity(std::stoi(tokens[76]));
SetX(std::stof(tokens[77]));
SetY(std::stof(tokens[78]));
SetZ(std::stof(tokens[79]));
SetPitch(std::stof(tokens[80]));
SetYaw(std::stof(tokens[81]));
}
// if (tokens[0] == "NPC_OBJECT") {
//
// }
}
示例5: GetY
void TrPdf::Subtract(TrPdf* that, bool logx, bool logy) {
for (int i=0; i<GetN(); i++) {
double y0 = GetY(i);
double y1 = that->Eval(GetX(i),logx,logy);
SetY(i,y0-y1);
}
}
示例6: SetX
void Game_Vehicle::SyncWithPlayer() {
SetX(Main_Data::game_player->GetX());
SetY(Main_Data::game_player->GetY());
remaining_step = Main_Data::game_player->GetRemainingStep();
SetDirection(Main_Data::game_player->GetDirection());
SetSpriteDirection(Main_Data::game_player->GetSpriteDirection());
}
示例7: GetCanvas
void Fire::Update()
{
if (GetEnabled() && (millis() - GetLastUpdate()) > 1000 / GetSpeed())
{
if (GetLastUpdate() != 0)
GetCanvas()->InvalidateRect(GetX(), GetY());
SetY(GetY() + GetVDir());
if ((GetY() + GetHeight() - 1) > GetCanvas()->GetScreenHeight() - 1)
{
SetEnabled(false);
SetLastUpdate(0);
}
else if (GetY() < 0)
{
SetEnabled(false);
SetLastUpdate(0);
}
if (GetEnabled())
{
/*
Serial.print(GetX());
Serial.print(",");
Serial.print(GetY());
*/
GetCanvas()->Paint(GetX(), GetY());
SetLastUpdate(millis());
}
}
}
示例8: Opponent
OpponentMisterKuba::OpponentMisterKuba( int x_, int y_ )
: Opponent( "misterkuba" )
, ti( 1 ) {
SetX( x_ );
SetY( y_ );
}
示例9: SetX
int Game_Character::EndJump(const RPG::MoveRoute* current_route, int current_index) {
jumping = false;
if (!IsLandable(jump_x + jump_plus_x, jump_y + jump_plus_y)) {
// Reset to begin jump command and try again...
move_failed = true;
if (current_route->skippable) {
return current_index;
}
return jump_index;
}
SetX(jump_x + jump_plus_x);
SetY(jump_y + jump_plus_y);
//TODO: C++11 got round() function defined in math.h
float distance = sqrt((float)(jump_plus_x * jump_plus_x + jump_plus_y * jump_plus_y));
if (distance >= floor(distance) + 0.5) distance = ceil(distance);
else distance = floor(distance);
jump_peak = 10 + (int)distance - GetMoveSpeed();
move_count = jump_peak * 2;
stop_count = 0;
move_failed = false;
return current_index;
}
示例10: SetX
void Game_Vehicle::SyncWithPlayer() {
SetX(Main_Data::game_player->GetX());
SetY(Main_Data::game_player->GetY());
real_x = Main_Data::game_player->GetRealX();
real_y = Main_Data::game_player->GetRealY();
SetDirection(Main_Data::game_player->GetDirection());
}
示例11: SetX
void Sprite_Battler::CreateSprite() {
sprite_name = battler->GetSpriteName();
hue = battler->GetHue();
SetX(battler->GetBattleX());
SetY(battler->GetBattleY());
SetZ(battler->GetBattleY()); // Not a typo
// Not animated -> Monster
if (battler->GetBattleAnimationId() == 0) {
if (sprite_name.empty()) {
graphic = Bitmap::Create(0, 0);
SetOx(graphic->GetWidth() / 2);
SetOy(graphic->GetHeight() / 2);
SetBitmap(graphic);
}
else {
FileRequestAsync* request = AsyncHandler::RequestFile("Monster", sprite_name);
request_id = request->Bind(&Sprite_Battler::OnMonsterSpriteReady, this);
request->Start();
}
}
else { // animated
SetOx(24);
SetOy(24);
SetAnimationState(anim_state);
idling = true;
}
SetVisible(!battler->IsHidden());
}
示例12: MSG_DEBUG
void Plane::Shoot(Double speed, const Point2i& target)
{
MSG_DEBUG("weapon.shoot", "Plane Shoot");
nb_dropped_bombs = 0;
last_dropped_bomb = NULL;
cible_x = target.x;
SetY(0);
distance_to_release = (int)(speed * sqrt(TWO * (GetY() + target.y)));
Point2d speed_vector;
if (ActiveCharacter().GetDirection() == DIRECTION_RIGHT) {
image->SetFlipped(false);
speed_vector.SetValues(speed, 0);
SetX(ONE - Double(image->GetWidth()));
//distance_to_release -= obus_dx;
if (distance_to_release > cible_x)
distance_to_release = 0;
} else {
image->SetFlipped(true);
speed_vector.SetValues(-speed, 0) ;
SetX(Double(GetWorld().GetWidth() - 1));
//distance_to_release += obus_dx;
if (distance_to_release > GetWorld().GetWidth()-cible_x - obus_dx)
distance_to_release = 0;
}
SetSpeedXY(speed_vector);
Camera::GetInstance()->FollowObject(this);
ObjectsList::GetRef().AddObject(this);
}
示例13: SetDirection
void Game_Character::Move(int dir) {
int dx = (dir == Right || dir == UpRight || dir == DownRight) - (dir == Left || dir == DownLeft || dir == UpLeft);
int dy = (dir == Down || dir == DownRight || dir == DownLeft) - (dir == Up || dir == UpRight || dir == UpLeft);
SetDirection(dir);
if (!(IsDirectionFixed() || IsFacingLocked())) {
if (dir > 3) // Diagonal
SetSpriteDirection(GetSpriteDirection() % 2 ? -dx + 2 : dy + 1);
else
SetSpriteDirection(dir);
}
if (jumping) {
jump_plus_x += dx;
jump_plus_y += dy;
return;
}
move_failed = !IsPassable(GetX(), GetY(), dir);
if (move_failed) {
if (!CheckEventTriggerTouch(Game_Map::RoundX(GetX() + dx), Game_Map::RoundY(GetY() + dy)))
return;
} else {
SetX(Game_Map::RoundX(GetX() + dx));
SetY(Game_Map::RoundY(GetY() + dy));
remaining_step = SCREEN_TILE_WIDTH;
BeginMove();
}
stop_count = 0;
max_stop_count = (GetMoveFrequency() > 7) ? 0 : pow(2.0, 9 - GetMoveFrequency());
}
示例14: SetMapId
void Game_Vehicle::SetPosition(int _map_id, int _x, int _y) {
SetMapId(_map_id);
SetX(_x);
SetY(_y);
real_x = _x * SCREEN_TILE_WIDTH;
real_y = _y * SCREEN_TILE_WIDTH;
}
示例15: TurnLeft
void Game_Character::MoveDownLeft() {
if (!IsDirectionFixed()) {
if (GetDirection() % 2) {
TurnLeft();
} else {
TurnDown();
}
}
if (jumping) {
jump_plus_x--;
jump_plus_y++;
return;
}
if ((IsPassable(GetX(), GetY(), RPG::EventPage::Direction_left)
&& IsPassable(GetX() - 1, GetY(), RPG::EventPage::Direction_down))
|| (IsPassable(GetX(), GetY(), RPG::EventPage::Direction_down)
&& IsPassable(GetX(), GetY() + 1, RPG::EventPage::Direction_left))) {
SetX(GetX() - 1);
SetY(GetY() + 1);
BeginMove();
stop_count = 0;
move_failed = false;
}
}