TheYellowArchitect / doubledamnation

Exclusively Co-Op Metroidvania with Movement as smooth as Smash Bros Melee
GNU General Public License v3.0
19 stars 2 forks source link

Level Editor - Pause to disable grabbing/removing tiles #47

Open TheYellowArchitect opened 2 years ago

TheYellowArchitect commented 2 years ago

tl;dr: Try clicking any settings, and not creating tiles in the background. Spoilers: You can't.

Luckily, its extremely easy to fix, and also takes little time.

TheN96 commented 1 year ago

So the controls don't swap over to a ui mode when paused is it?

TheYellowArchitect commented 1 year ago

Mouse Click does a manual raycasting from the mouse onto the 2D grid. Left click creates a tile-type at the selected tile. Right click deletes/erases a tile-type at the selected tile (if it is occupied)

If a pause/settings menu is over the 2D grid, it is not taken in mind, raycasting still happens. So the solution is as simple as going to the manual raycasting code and adding a boolean flag condition for disabling it. The flag is ofc PauseMenu.GameIsPaused

It is that easy^, hence the good first issue tag

TheN96 commented 1 year ago

Hey, thanks for the reply. While that is easy to do, I think a better solution may be to have a separate mapping when paused. I.e. that it should not do a raycast at all if clicked if in a pause menu. This applies to keyboard controls etc.

Now, I'm still familiarising with your code so I won't mess around too much. I think I'll set the boolean flag you mentioned in the DetermineLeftClick() function (mouse script) rather than in the update. I think you do some checks using the cursor position.

TheYellowArchitect commented 1 year ago

I apologize for answering so late, was without internet for a few days

I think a better solution may be to have a separate mapping when paused. I.e. that it should not do a raycast at all if clicked if in a pause menu. This applies to keyboard controls etc.

I don't understand what you mean by seperate mapping, though you do need raycasting for the mouse to click the (pause menu) buttons. But you should disable the raycasting for level editor (approximately where I linked above)

Now, I'm still familiarising with your code so I won't mess around too much. I think I'll set the boolean flag you mentioned in the DetermineLeftClick() function (mouse script) rather than in the update.

It would work, but DetermineLeftRightMouseInput() also raycasts via other click buttons (even mouse button 3 and 4), which would result in right click deleting the tiles in the background. Right click and other click buttons are not used at pause menu or settings, so I guess it doesnt really matter, and just by putting the flag on DetermineLeftRightMouseInput() would fix this bug and I can close this issue :+1:

I think you do some checks using the cursor position.

I use that condition for the tiletypes to the left UI, so when you select what tile-type you want to build, it won't build tiles behind the UI panel. As for the value, the UI is hardcoded to use 15% width of the screen (starting from the left)

==================

Off-topic: I thank you for the interest to Double Damnation, I open-sourced it but I didn't expect anyone want to update it even a little, especially given how few have finished it (exclusively local multiplayer games are dead in 2022). Since you may have plans to update it, I consider it fair to share my plans for Double Damnation: I don't plan to return to develop it for at least a year (though I had to write these git issues as to what I would do if I had continued), especially since Double Damnation is feature-complete (sure it has bugs, but nothing is missing from my original vision when you play local multiplayer)