How do I make an "if" condition? and problem with animation

Just started using Construct 2? Post your questions here

Post » Tue Mar 01, 2016 10:55 pm

Message: FlashGordon007 can only post plain text URLS until they have 500 rep. 2 URLS modified. Why?
Good Evening Constructioners

I need help with an easy task i think .
I'm trying to remake the first level of Superman Arcade game. https://www.youtube.com/watch?v=-dpDGhbapW4

And for now i'm trying to remake the behavior of Superman.

I set 3 behavior
1. platform
2. 8 direction (no set angle)
3.ScrolTo

How can i set a condition like :
When the sprite is not on floor or have the 8 direction enable (needed to let the man fly) and if key press is "A" set animation to "flyPunch"?
When the sprite in not on floor and it stand set animation to "standFly"
And the last one, if you want to try my project you will see the "bulky" move it does (it's like moving a tank)

https://www.dropbox.com/s/9tt2mvcvr0f1t ... .capx?dl=0

thx for the help
B
3
Posts: 6
Reputation: 187

Post » Wed Mar 02, 2016 11:36 am

1/ The link is incomplete, so i do not know how far you are in the basics. So first some basics about the 'IF' conditions.

An event has 2 parts. The condition(s) (left block) and actions (right block).

There are basecaly 5 sorts of conditions.
- The triggers
- The loop organizers
- The pickers
- The IF statements (in fact all the others)
- ( and the specials ELSE & OR)

You can have more then one condition in the same event-block.
Just right-click the event and choose 'add another condition".

That way you can combine a trigger with an IF.
Ex.: first line 'key button pressed' and a second line 'is the mouse over an object'

The actions will do their thing when both conditions are true.

You can also combine a lot of IF's.

If you combine conditions in one event, they al got to be true to make the actions work.

Right-click the event to make it a 'or' statement. The actions will then work if one of the conditions is true.

2/ About the 'bulky' move.

You have 2 behaviours on 1 object that can handle the movements of the object. Stick to 1 behavour.
Preferable the platform behaviour. Platform can move the object left, right and it can jump. Down it goes by falling.
Platform has all the actions to do so. You do not need the 8 direction.
If you need other keyboard triggers then the default triggers, change the default controls propertie. And add the keyboard object to handle the keybord triggers.

To handle the animations the platform behaviour has triggers that tell you what the object is dooing. Use the 'On jump" to change the animation to jumping. Use 'On landed' to change it back.

Never burry triggers deep down somewhere in the events. Keep them top level. Most triggers start with 'On'.

Keep in mind that 'ground' is any object with the solid behaviour set. To just jump, the solid has to stand on a solid.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 0 guests