sgn15's Forum Posts

  • create an instance var for enemies called AI (number-type)

    When AI = 0 and every 2 secs,

    -> Set AI to choose(1,2)

    When AI = 1

    -> Simulate enemy "Right"

    -> Set enemy to walk animation

    -> Set enemy Not Mirrored

    When AI = 2

    -> Simulate enemy "Left"

    -> Set enemy to walk animation

    -> Set enemy Mirrored

    Enemy has a wall to right

    -> Simulate enemy "Left"

    -> Set enemy to walk animation

    -> Set enemy Mirrored

    Enemy has a wall to left

    -> Simulate enemy "Right"

    -> Set enemy to walk animation

    -> Set enemy Not Mirrored

    That's a basic AI. You can set AI = 3 for run right, 4 for run left, 5 for attack, 6 for hurt, etc. if you want more complex AI

    For run and attack, I suggest using a var to store every tick the distance between you and every enemy so each enemy will calculate its own unique distance from you, then use that distance variable to determine when enemy will attack (for example X<50 when close range attack, x>150 when long range attack). Differentiate Run from Walk by the speed (adjust both max speed and vector x for both run and walk). Of course animations of Run and Walk should be different, or at least different in animation speed.

    Oh I forgot, you have to use "For Each: Enemy" on every single event of AI to make each behave independently from other enemy instances.

    I hope this gets you started on AI. Good luck.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I'm not sure if I get you. But if the "body" and "hand" are separate objects and the hand is pinned to the body, you can use

    "Pick by comparison" like this

    Pick "hand" which body.UID = hand.pin.pinnedUID

    It means even if there are more than 1 hand object instance in the layout, you're picking the hand that's specifically pinned to the body. Just add another condition if there are multiple body instances in the layout select which (or "for each" condition) instance of body object.

  • Are you asking how to use the pin behavior? because I don't think there's any restriction that you can't pin to a sub-object

  • Is it possible to make a "footage" of my layout (onscreen part of the layout) as part of the inside of that same layout? I have an idea of a layout in a security room with a TV and that TV is showing that same room. Meaning the footage is live and animated.

    Is this possible in C2?

  • How do I make only my player move/animate during a certain period AND make everything else (enemies, animated backgrounds) not move during same period) ?

    I tried this:

    Player is playing "Attack"

    Player's frame >= 0

    Player's frame <= 4

    -> Set time scale for Player to 0.5

    -> Set game time scale to 0.0

    and this

    Player is playing "Attack"

    Player's frame >= 0

    Player's frame <= 4

    -> Set game time scale to 0.0

    -> Set time scale for Player to 0.5

    Both doesn't make the enemies or animated background stop animating/stop moving.

    It says in description that object time scale OVERRIDES game time scale, so the first event above should work, right?

  • https://www.scirra.com/tutorials/67/del ... dependence

    This article shows how to use dt as expression, but I can't figure out which condition to use to be able to include dt in it (condition)

  • well the last post here explained it to me

    and this is another situation where I need delta time I think

    Bullets have instance var called Bullet_Enabled (text-type), initial value is "No"

    When bullets hit player and player is NOT using guard animation

    -> disable bullet behavior

    ->Set Bullet_Enabled to Yes

    ->Wait 0.5 secs

    ->Destroy bullet

    When bullets hit player and player is using guard animation

    -> bounce bullet off player

    ->Wait 1.5 secs

    ->Destroy bullet

    The significance of the "Yes" value of Bullet is in the damage system of the player, meaning Bullet_Enabled having a value that is not "Yes" will not hurt the enemy (damage player's life, make player use damage animation)

    Not all bullets are bounced, and not all bullets that are supposed to damage player does. Both situations are iffy.

  • Every 1 Second

    -> Add 1 to a global variable

    Every Tick

    Set Text object's Text to global variable's value

  • I have a platformer side scroller game that has damage system (player attacking enemies and vice versa), I use "on collision with another object" as condition for attacking.

    When my player is hit by enemy, I disable all controls (custom movement, attacks) while showing damage animation.

    I have noticed that it works fine, BUT when I don't release my press on my movement keys WHILE player is being hit, the availability of the controls PERSISTS during damage animation of player.

    So I have come to the conclusion that I need to check the collision more frequently than I have now.

    How do I use delta time as additional condition to add to my already existing events?

  • sine behavior will do that for you, up-down or left-right or sine movement, all possible

    I believe there are example of that in C2 already

  • borneoboy

    very simple solution for shooting both sides is to create a player variable called "Facing"

    Always (Every tick) set the value of Facing to 1 if your player is facing RIGHT

    and set to -1 if facing LEFT

    Shoot a bullet

    then Bullet: Set Bullet Speed to 300*Bullet.Facing

    it should shoot left when player is facing left, shoot right when player is facing right

  • blackhornet

    thanks. that gave me another idea to use for another concept

    korbaach

    thanks for giving a working example. But I want to learn it not just copy the codes. Can I ask a few questions?

    1. How exactly does overlapping at offset works? I read description and I don't get it?

    2. this expression

    lerp(Sprite3.Angle,Sprite2.Var_angle,dt*20)

    ^I get that Var_angle. what is dt? I don't get what dt means.

    dt

    Return delta-time according to the object's own timescale. See Delta-time and framerate independence for more information.

    description from

    https://www.scirra.com/manual/126/system-expressions

  • I need a condition that means platform object (player) is on top of a SPECIFIC INSTANCE of jumpthru object to make the player follow the angle of the jumpthru object.

    There are MULTIPLE instances of the jumpthru object, each with DIFFERENT angles so I really need the condition that means player is stepping on a specific instance.

    I only need the condition, I already know the action.

    Already tried these (one at a time)

    overlapping

    collision

    platform: is on floor

    Any ideas I can try? Thanks in advance.

  • newt

    C: System: At start of layout <----I think this is wrong but not sure what to replace it with

    A: Audio: Play int(random(5)) from Music

    A: System: Wait "Audio.Duration" secs <--- duration can't take 0 parameters, tried "Audio.Playbacktime" same issue

    How can I set the duration if the music files are not same duration?

    jobel

    thanks. please check your pm.

  • anyone?