TModLoader v1.4.4.9
TModLoader source code documentation
Loading...
Searching...
No Matches

◆ BordersMovement()

void Terraria.Player.BordersMovement ( )
inline

Definition at line 22394 of file Player.cs.

22395 {
22396 if (position.X < Main.leftWorld + 640f + 16f)
22397 {
22398 Main.cameraX = 0f;
22399 position.X = Main.leftWorld + 640f + 16f;
22400 velocity.X = 0f;
22401 }
22402 if (position.X + (float)width > Main.rightWorld - 640f - 32f)
22403 {
22404 Main.cameraX = 0f;
22405 position.X = Main.rightWorld - 640f - 32f - (float)width;
22406 velocity.X = 0f;
22407 }
22408 if (position.Y < Main.topWorld + 640f + 16f)
22409 {
22410 if (Main.remixWorld || forcedGravity > 0)
22411 {
22412 if (position.Y < Main.topWorld + 640f + 16f - (float)height && !dead)
22413 {
22414 KillMe(PlayerDeathReason.ByOther(19), 10.0, 0);
22415 }
22416 if (position.Y < Main.topWorld + 320f + 16f)
22417 {
22418 position.Y = Main.topWorld + 320f + 16f;
22419 if (velocity.Y < 0f)
22420 {
22421 velocity.Y = 0f;
22422 }
22423 gravDir = 1f;
22424 }
22425 }
22426 else
22427 {
22428 position.Y = Main.topWorld + 640f + 16f;
22429 if ((double)velocity.Y < 0.11)
22430 {
22431 velocity.Y = 0.11f;
22432 }
22433 gravDir = 1f;
22434 }
22436 }
22437 if (position.Y > Main.bottomWorld - 640f - 32f - (float)height)
22438 {
22439 position.Y = Main.bottomWorld - 640f - 32f - (float)height;
22440 velocity.Y = 0f;
22441 }
22442 if (position.Y > Main.bottomWorld - 640f - 150f - (float)height)
22443 {
22445 }
22446 }
static PlayerDeathReason ByOther(int type, int playerIndex=-1)
Vector2 velocity
The velocity of this Entity in world coordinates per tick.
Definition Entity.cs:33
Vector2 position
The position of this Entity in world coordinates.
Definition Entity.cs:28
int width
The width of this Entity's hitbox, in pixels.
Definition Entity.cs:46
int height
The height of this Entity's hitbox, in pixels.
Definition Entity.cs:51
static void HandleSpecialEvent(Player player, int eventID)
void KillMe(PlayerDeathReason damageSource, double dmg, int hitDirection, bool pvp=false)
Definition Player.cs:37626

References Terraria.Main.bottomWorld, Terraria.DataStructures.PlayerDeathReason.ByOther(), Terraria.Player.dead, Terraria.Player.forcedGravity, Terraria.Player.gravDir, Terraria.GameContent.Achievements.AchievementsHelper.HandleSpecialEvent(), Terraria.Entity.height, Terraria.Player.KillMe(), Terraria.Main.leftWorld, Terraria.Entity.position, Terraria.Main.remixWorld, Terraria.Main.rightWorld, Terraria.Main.topWorld, Terraria.Entity.velocity, and Terraria.Entity.width.

Referenced by Terraria.Player.Update().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: