Event Help

illegalbloodmarket's picture

So here's what I'm trying to do in my game:

I have one active object girl facing to the right. Every couple seconds, she flips around during its animation to face the left. The screen is filled with gems, treasures, etc and you gain money by clicking on them. I want to make it so when the girl is facing the left (in view of all of the treasures) clicking on a treasure results in losing all of your points and displays a text object saying you got caught. It's like a shoplifting mini-game. I already have it so click on objects gives you money and gaining enough money will give complete the level, but I can't figure out the 'getting caught' dynamic.

Any help?

spiral's picture

I dunno what program you're

I dunno what program you're using so I don't know what specifics I can give you. The easiest solution of course would be to have a check for if the user clicks any treasure, AND the girl is facing to the left.

You could set a variable every loop if a treasure is clicked on, then check if that's set and the girl is looking left, then set the variable back to 0 at the end of the loop.

That about sums it

Nicely worded. Back to the OP, Use the Direction/compare direction event if you're using hte program I'm guessing you're using. It should be under the label directions... add the other event user clicks on a treasure to the same line, i guess in this case any order should work and you're good to go maybe?

Danni's picture

You mean add a condition,

You mean add a condition, not an event.

General overview of actions, conditions, events:

An ACTION is something you can perform on an object or the game system. For example, "Stop", "Change animation sequence to Win", and "Subtract 1 from Player 1's lives" are all actions.
A CONDITION is a statement that may be true or false. For example, "Player is overlapping Button" and "Player's direction is left" are conditions. Conditions can also limit the scope of actions. For example, we might have multiple Mouse objects and multiple Cheese objects. The condition "Mouse is overlapping Cheese" would cause actions to be performed only on those mice and cheese that are overlapping each other, and no other mice or cheese.
An EVENT is a group of conditions and actions. When all of the conditions in an event are true, the event's actions are performed.

Since the OP wants to have something happen when clicking on a gem AND the girl is facing left, one will need to place two conditions in an event:

- Create a new event. Have the condition be "User clicks with left button on Treasure" (found under Mouse pointer and keyboard).
- Right-click on the number at the left side of the event and click "Add condition". Have this new condition be "Girl is facing direction left".

Also, a note on the direction condition: unless you're using TGF2, MMF2, or a recent build of MMF 1.5, avoid selecting multiple directions to compare against. This won't do what you expect. It looks like the condition will be true when the object is facing any of those directions. In reality, what happens is the game will pick one of those directions at random and if the object is facing that direction, the condition will be true; otherwise it'll be false.

sergiocornaga's picture

I just want to add that

I just want to add that you'll have to do things a little differently if the girl is only turning left in visual terms (i.e. as a frame of an animation that is all part of the same direction). I don't know of a way to check for that (admittedly I am a klik noob), so hopefully you're using paths or something! Good luck.