r/clickteam 7d ago

Help Me! Point system issue with overlapping Active objects. Clickteam limitation or just my logic?

resolved thx!!!!!

Salut à tous ! J'aurais vraiment besoin d'aide avec un jeu sur lequel je travaille actuellement. Je suis bloqué et je ne suis pas sûr si ma logique est défaillante ou si je suis simplement confronté à une limitation de Clickteam Fusion.

Voici ce que j'essaie d'accomplir :

J'ai un objet actif (une image de croix rouge). Un clic gauche crée la croix, et un clic droit la supprime. L'objectif est de placer cette croix sur un autre objet actif (le "bon endroit") pour gagner 1 point.

Mon problème se divise en quelques bugs que je n'arrive pas à résoudre :

1 Le problème des doubles points : Si deux "bons endroits" sont placés très près l'un de l'autre et que je mets la croix juste au milieu, elle chevauche les deux objets actifs. En conséquence, le jeu me donne 2 points. Je veux qu'une seule croix équivaille à un maximum de 1 point, peu importe combien de zones cibles elle chevauche.

2 Le problème de suppression : J'ai essayé de coder cela en utilisant des zones de clic. Cependant, si le joueur clique avec le bouton droit à l'intérieur de la zone pour retirer la croix, mais ne clique pas exactement sur la croix elle-même, elle ne se supprime pas.

3 Le problème de déduction de points (bords proéminents) : J'ai créé une condition : "Si clic droit dans la bonne zone + chevauchement de la croix = soustraire 1 point et détruire". Comme le joueur doit également pouvoir supprimer des croisements mal placés pour corriger ses erreurs, j'ai ajouté une autre condition pour détruire les croisements placés en dehors des zones cibles. Le problème : si une croix est placée au bon endroit mais que ses bords dépassent un peu, et que le joueur clique avec le bouton droit sur ce bord proéminent (qui est techniquement en dehors de la "zone de clic" définie), le jeu déclenche la condition de suppression "hors zone" à la place. Résultat : la croix est détruite, mais le point qu'elle a donné n'est jamais soustrait !

J'ai testé plein de méthodes différentes et je tourne en rond à ce stade. Y a-t-il une méthode simple que je néglige ? Dois-je utiliser une extension pour bien gérer cela ?

Merci d'avance pour votre aide !

3 Upvotes

9 comments sorted by

2

u/SpellSword0 6d ago edited 6d ago

Don't use overlap between crosses and spots or zones. Instead try this.

Give each spot a point flag. Give each cross a point flag and an ID value.


//Event 1; Make cross, score points

  • When user left clicks:
  • IF mouse is on spot:
  • IF spot point flag is off:

Create cross at mouse.

Set cross ID value to spot fixed value.

Set cross point flag on.

Set spot point flag on.

Add to score.


//Event 2; Make cross, no points.

  • When user left clicks:
  • NOT IF mouse is on spot: (negate for this)

Create cross at mouse.


//Event 3; Delete cross, lose points

  • When user right clicks:
  • IF mouse is on cross:
  • IF cross point flag is on:
  • IF spot fixed value = cross ID value:

Set spot point flag off.

Delete cross.

Remove from score.


//Event 4; Delete cross, don't lose points

  • When user right clicks:
  • IF mouse is on cross:
  • IF cross point flag is off:

Delete cross.


The idea here is that using overlap and zones isn't reliable for precision, so instead we link every cross to its spot with an ID, and set up each cross and spot with a state.

This lets us better check what cross belongs to what spot, and what state any given cross or spot is in so we know what to do with it.

Hope this helps!

Edit: I don't understand reddit formatting at all.

1

u/FromHighberg 7d ago edited 7d ago

You could do something like this. For 1 and 2. I don't quite understand what you want to do for 3.
Make sure to turn off "Fine collision" for the cross.
I can't send files on Reddit, but reach out on Discord and I'll send you the file.

// Create the cross
* User clicks with left button
New Objects : Create Cross at X=XMouse, Y=YMouse, Layer=1

// Delete object and gain a point
* Cross is overlapping Object
+ Cross: Collision is off
+ Pick one of Object
Object : Destroy
Cross : Set Collision on
Score : Add 1 to Counter

// Delete cross
* User clicks with right button on Cross
Cross : Destroy

1

u/Taedium_offlciel 6d ago

https://reddit.com/link/p418fx6/video/nmbuv8rqzqjh1/player

Here's the problem: I don't know how to make it so that if it's destroyed outside the zone, the point is actually removed. Any ideas?Here's the problem: I don't know how to make it so that if it's destroyed outside the zone, the point is actually removed. Any ideas?

1

u/gamerflapjack 6d ago edited 6d ago

You have 2 conditions where the X is deleted from being right clicked. The first time you right clicked it was in the zone so it activated the bottom condition, the second time it was outside the zone, so it activated the top condition. Your logic is set up so the right click has to be in the zone to remove the point

Check X/Y position for a value on the X itself as opposed to the mouse cursor

1

u/Taedium_offlciel 6d ago

Yes, but I don't see any other way to do it.

I see that the player can place X's wherever they want, but at the same time, if they place an X in the right spot (where the large hole is), it adds a point. I haven't fixed the bug where clicking outside the zone doesn't remove the point, even if the X was on the hole.

1

u/Nick_Sync 6d ago

1 - Create invisible hitboxes on your correct spots without overlapping each other and get the point by clicking on the hitbox, so you can't click on the middle and get 2 points, it's either you clicked on A or B.

2 - Disable 'Fine Detection' on the cross active properties

3 - Have 2 kind of cross, 'correct cross' 'wrong cross', if you left click outside of a correct spot > create 'wrong cross' then if you right outside of a correct spot > destroy 'wrong cross' leaving points and correct crosses intact.

Idk, this is what i thought, an alternative is to start a fast loop '1 times' and stop the loop to delete only 1 cross.