0 votes

So I had a functional fireball type mechanic where when you pressed the shoot button a projectile launched from a Position2d node slightly in front of the player, a few tiles I wanted to use weren't lining up correctly so I changed the cell size from 64x64 to 32x32, but when I went to test my level my projectile now fires way below the Position2d node, I quickly tried changing back to cell size 64x64 but the projectile location is still way off the Position2d node, I tried just moving the Position 2d node waaay up to compensate but without knowing the actual location it's shooting from it's really hard to get it to be able to shoot both directions correctly without colliding with the player. I also tried deleting the old position2d and making a new one but it didn't help. Anyone know how I can fix this? here's my code, the projectile is called staticball;

const StaticBall = preload("res://StaticBall.tscn")

if Input.isactionjustpressed("SHOOT"):
shooting = true
anim = "shoot"
$Sprite.play(anim)
$shootime.start()
var staticball = StaticBall.instance()
if sign($Position2D.position.x) == 1:
staticball.set
staticballdirection(1)
else:
staticball.set
staticballdirection(-1)
get
parent().addchild(staticball)
staticball.position = $Position2D.global
position

func onshootime_timeout():
shooting = false

Godot version 3.3.3
in Engine by (16 points)

1 Answer

0 votes

Find and show the piece of code, that depends on TileMap anywhere. There must be somewhere You are referrencing to TIleMap ( getnode("TIlemap"), $Tilemap) or some node which is using Tilemaps functions ( for example worldto_map() ).

If You can't find any, it is eventually issue of TileMaps children retransforming. In this case try to change every "position" property into "global_position" in this code above.

staticball.global_position = $Position2D.globalposition
by (7,925 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.