Newbie, want to make a point system in my dress up game in godot for endings

Hello, just so you know, I’m a newbie in programming in general, so I ask you to be easy on me even if the question is resolved just by going through the docs (already did that, still have hard time understanding it).

I’m working on a dress-up game that has a character that won’t want to wear certain clothes and if there are clothes on him that he doesn’t like, the game will lead to a bad-ending scene and vice-versa.

I can search how to make events lead to changing a scene by myself. The actual questions are:

  1. How do I group the clothes properly (I think I should look up global groups on docs here)?

  2. How do I make points reset when clothes are dragged away from their perfect position (i.e. on character sprite)?

  3. How do I make clothes correspond with eachother for the point system (explained further)?

Current issues

I’m away from my laptop, so can’t provide exact code for now, so I’ll do my best to explain

The code I’m using is from this tutorial

Pastebin with the drag and drop function itself as well

What I tried to do is a boolean @export for bad and good clothes, then go through if-elif statements for them in a drag and drop code, which sorta works, but:

  1. Points get attributed only to one clothing (for example: I drag a yellow shirt as a good clothing type and get +1 to the point variable (therefore it is =1), but when I drag pants from the same type, it doesn’t consider previous +1 and stays =1)

  2. Points don’t reset after clothes being reattached (if I drag away said yellow shirt and drag it back to the perfect position, it still will add a +1 and the point variable will equal 2 and so on)

@godot

#godot #duckduckfedi #askfedi

  • Buddahriffic@lemmy.world
    link
    fedilink
    arrow-up
    1
    ·
    17 days ago

    At a high level, there’s two main ways to handle increasing/decreasing scores: event-focused or state-focused.

    For event-focused, you basically have different events that can affect the score. Adding clothing with trigger an event that adds score if it’s a good placement or reduces if it’s bad, and then vice versa for removing clothes. You can have other modifiers like maybe the first time something is worn, extra points are awarded or maybe preferences are modified.

    For state-focused scoring, you’ll pretty much recalculate the score from 0 each update. Clothes being worn get added to the score and clothes not worn don’t affect it. This one has less flexibility but is more likely to end up with a coherent score because it’s being recalculated from scratch each time (so any bugs will be easier to reproduce).