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

◆ PullItem_Common()

void Terraria.Player.PullItem_Common ( Item itemToPickUp,
float xPullSpeed )
inlineprivate

Definition at line 33178 of file Player.cs.

33179 {
33180 if ((double)position.X + (double)width * 0.5 > (double)itemToPickUp.position.X + (double)itemToPickUp.width * 0.5)
33181 {
33182 if (itemToPickUp.velocity.X < itemGrabSpeedMax + velocity.X)
33183 {
33184 itemToPickUp.velocity.X += itemGrabSpeed;
33185 }
33186 if (itemToPickUp.velocity.X < 0f)
33187 {
33188 itemToPickUp.velocity.X += itemGrabSpeed * xPullSpeed;
33189 }
33190 }
33191 else
33192 {
33193 if (itemToPickUp.velocity.X > 0f - itemGrabSpeedMax + velocity.X)
33194 {
33195 itemToPickUp.velocity.X -= itemGrabSpeed;
33196 }
33197 if (itemToPickUp.velocity.X > 0f)
33198 {
33199 itemToPickUp.velocity.X -= itemGrabSpeed * xPullSpeed;
33200 }
33201 }
33202 if ((double)position.Y + (double)height * 0.5 > (double)itemToPickUp.position.Y + (double)itemToPickUp.height * 0.5)
33203 {
33204 if (itemToPickUp.velocity.Y < itemGrabSpeedMax)
33205 {
33206 itemToPickUp.velocity.Y += itemGrabSpeed;
33207 }
33208 if (itemToPickUp.velocity.Y < 0f)
33209 {
33210 itemToPickUp.velocity.Y += itemGrabSpeed * xPullSpeed;
33211 }
33212 }
33213 else
33214 {
33215 if (itemToPickUp.velocity.Y > 0f - itemGrabSpeedMax)
33216 {
33217 itemToPickUp.velocity.Y -= itemGrabSpeed;
33218 }
33219 if (itemToPickUp.velocity.Y > 0f)
33220 {
33221 itemToPickUp.velocity.Y -= itemGrabSpeed * xPullSpeed;
33222 }
33223 }
33224 }
Vector2 velocity
Definition Entity.cs:16
Vector2 position
Definition Entity.cs:14
static float itemGrabSpeedMax
Definition Player.cs:2123
static float itemGrabSpeed
Definition Player.cs:2121