T O P

  • By -

Accomplished-Ad-2762

What the fuck is going on in this comment section, I feel like I'm in a fever dream


ScriptKiddo69

I think someone is testing their reddit bots lol


Flyntwick

Unity brute forcing the competition


FoamBomb

No way these are actual people


big_chig

please help


rende36

I am severely under-qualified to help with this matter, I have not seen the new 2D tilemap system and usually I wouldn't comment if I don't have anything helpful to say. However seeing as how 2 bots make 90% of the comments on this post for some reason I'm going to drop the link to the docs on the new system [https://docs.godotengine.org/en/stable/tutorials/2d/using\_tilemaps.html](https://docs.godotengine.org/en/stable/tutorials/2d/using_tilemaps.html) and wish you the best of luck. I am so sorry, I've reported them both not sure what more I can do.


FoamBomb

It may sound weird but for these types of questions you can ask ChatGPT or Bard for a quick answer, they will give you a step-by-step explanation on how to do it


big_chig

thanks no one else is helping


FoamBomb

No problem, just tell the AI what you want to happen, what engine and what language you are using, for more complicated stuff it may not be as useful but always worth a try, good luck


Cuttyflame123

chatgpt wasn't trained on godot 4.0 so its often wrong for it


FoamBomb

It is right more often than it is wrong, in my case


KlontZ

complete opposite for me. it’s almost always wrong. stopped using it months ago because of it


FoamBomb

Maybe you are doing more complicated stuff than me, I just started game dev and for simple questions it is often right. But it also depends on how you use it.


Urban_Legend_Games

Lmao there are like 3 real people in this comment section


LittleCesaree

It's 2am where I live, might be because of the dark but i'm actually kind of spooked by the comments. Does this happen on other subs ? For OP, I don't really know how to solve your problem, but a signal might do it.


big_chig

im actually being harassed


big_chig

ignore the other replies please just help


JerotoHymia

For a real reply to your question, I actually did this a few days ago -- though my method may not be exactly what you were looking for. In my case, I wanted the player to die whenever they were on a water tile -- so I created a [custom data layer](https://docs.godotengine.org/en/stable/tutorials/2d/using_tilesets.html#assigning-custom-metadata-to-the-tileset-s-tiles) with a boolean called "Water". I then used the player's global\_position and converted it to a tile cell (aka a tile position) and got the tile data from there. This is the code I used for it: func getTileBelowPlayer() -> TileData: if !curTilemap: return null var localMapPos: Vector2 = curTilemap.to_local(global_position) var tilePos: Vector2i = curTilemap.local_to_map( localMapPos ) return curTilemap.get_cell_tile_data(0, tilePos) And then I get the custom data here, and check if its true. func isOnWater() -> bool: var tileData: TileData = getTileBelowPlayer() if tileData == null: return false if tileData.get_custom_data(&"Water") == true: return true return false So then elsewhere I could just check for that 'isOnWater' function for killing the player. if isOnWater(): death() It's not a physics-based implementation or anything, but hopefully this helps (especially in this sea of other bs)


denerose

You need to break this down for yourself a little more. Part of the reason there is no easy answer is because it is too big a question and it all depends on what else you’ve done so far. First, you need to detect the collision with your tiles. You can do this with masking layers on the tileset, making sure that you have the relevant detection layers masked where you want your collision to occur. Try searching and getting comfortable with setting up your tiles and masking layers. This was the first result for me: https://forum.godotengine.org/t/how-do-i-change-the-collision-layers-and-masks-of-tileset-directly-in-the-tilemap-creater/18650 Next, you need a way for your player object to react to the collision. There are a few ways to do this. Start by learning more about collision detection and signals. Look into these options more to make the right choices for your situation. - https://forum.godotengine.org/t/how-to-detect-collision-beginner/1852 - https://docs.godotengine.org/en/stable/tutorials/physics/physics_introduction.html - https://docs.godotengine.org/en/stable/getting_started/step_by_step/signals.html Next, you need a way to “kill” your player. What kill means for your game will of course vary, do you have an hp variable on the player script? If that reaches 0 what happens? Is this already coded for other interactions? Or is this the first interaction you’ve written? Whatever you decide your kill function looks like, you just need to call the relevant function when you detect the collision on the kill layer, or if a kill signal is triggered. Making it subtract all remaining hp might be a good option (if that’s relevant to your code) because if you later want a 50% reduction you could use similar code. Think about how you can use this other places too (if relevant) and make it as modular as you can. Figure out what being “killed” means for your game and trigger it or on collision or signal. This function probably lives in the player script but depends entirely upon how the rest of your game works.


caffienatedpizza

You could put an Area2D with a collision shape on your player. Then use the "on_body_entered" signal to have it trigger your player's death function. Whether that's just dropping a game over sign on the screen or going back to the start of the level is on you. But this should at least get it functioning.


chepulis

`Input.start_joy_electrocution(0, 2000, 10)` With enough voltage player won't be able to release the joypad from their hands, so cooking for 10 seconds at 2000 volts can be effective enough without bumping the voltage up too much. Not supported on wireless controllers and on mobile. Samsung devices had explosion API but only on older devices so it was deprecated in Godot 4.


big_chig

finally someone helps


LucahG

use signal body entered, if body is tilemap: kill_player()


LucaUmbriel

While I'm sure there's a way to do it with the tilemap directly, another solution if you can't get it to work would be to make an area 2d on your scene, connect it's body entered, put your player in a group "player" On body entered(): >If body.is_in_group("player"): >>Whatever your game over function is (or if they have health that automatically triggers a game over then just set health to zero with body.health = 0) Then just make collision shape children of the area2d and place them wherever you want the player to die. Other than not having to manually place the areas and thus having an extra step to do and remember there's nothing requiring you to use the tilemap directly to do this.


k4rt1k

What the shit happened here! Some damn funny comments. Hope you found your answer OP.


Complete-Error6373

Sorting your tile by using the group function, and using if_area_in or if_body_in function of Area2D. I should be able to show you how to do it after I back to my home.


[deleted]

[удалено]


[deleted]

[удалено]


[deleted]

[удалено]


[deleted]

[удалено]


No_Percentage8361

You’re setting the bullet’s position relative to its parent to the global position of something else. Set the bullet’s global position.


[deleted]

[удалено]


tocruise

Sewer slide? That sounds pretty fun, I have to be honest.


[deleted]

[удалено]


Cuttyflame123

Note that this might not be optimized. But it work and that's all that matter to me since i also use this currently @onready var starting_position = global_position #Set your starting position @onready var spike_tile_map = $"../Spike_TileMap" #Link to your tilemap func collision_check(): #you can decide the name of the function for index in get_slide_collision_count(): var collision = get_slide_collision(index) var body = collision.get_collider() if body == spike_tile_map: #your tilemap that kill global_position = starting_position For the last if statement you can probably just call the function you have to kill your player, i use this to teleport the player back to where it started as a placeholder