sgn15's Forum Posts

  • Because the manual said to use a rectangle invisible object for platform behavior and pin the actual object (containing the animations) to the rectangle object

  • Ok thanks. I want to ask something about the "For Each" you previously mentioned.

    So with the fixing of the run events, I finished the system of my basic enemies. I used instance variables to make the enemy move, attack, take damage and die. So I thought I can create multiple instances already of my enemy in the layout and they will behave (independent from each other) using the same events. But they did not.

    I did not use a container (I have my own reasons why), but here is how I coded it:

    I use families except for object specific events.

    GoonBoxes (family name) - contains different goonbox objects, but I only have 1 object under this family at present

    Goons (family name) - different objects in this, but only 1 goon coded (the one corresponding to the only goonbox I have so far)

    +start of layout

    ->Goonbox (not the family) object spawns goon object (not the family)

    an instance var for AI is randomized every 3 secs to 1 or 2 (for walking left and right) and it will keep walking left and right until it sees the enemy (this is when it will run towards player and attack it and goes back to stance and can go to run and/or attack again if the player is near). Distance from player is being checked every tick.

    Attack animation uses object instead of family

    +Goon's animation "Attack" is playing

    +animation frame = 7

    +Goon colliding with Playerbox

    ->Set Player to Damage (this isn't the real event, it's too long to type but you get the idea)

    Then everything else is in instance variables.

    So because it doesn't work for multiple instances, I tried adding "For Each GoonBoxes (family) object" condition to each and every single event related to my enemies, but I get an error about loop like this: http://oi62.tinypic.com/oswjf8.jpg

    How do I fix this and make my enemies behave independently from each other using the same events?

    I really thought the essence of instance vars was for this situation but ugh.... help please.

  • so these WebGL only effects won't work if I export my capx into desktop?

  • what is "WebGL" ? It says the effects are "WebGL only"

  • Is it possible to select a color from a sprite object and change it to another color?

    Basically, I intend to make an alternate palette for my character (for those familiar with "palette")

  • oh, that actually solved the problem! thanks man.

    So, when can I appropriately use the "System - > Compare two values" condition?

    I would like to ask some questions.

    What is the difference between "Overlapping" and "Colliding"? Some objects doesn't have the "colliding with another object" condition?

    How do you make a "spawned" (or even those not spawned) object's sprite be always "over another object's sprite?

  • 7Soul

    Ok. but at this point, even if I am using instance variables and that system event, I only have 1 GoonBox and 1 Goon object in the layout though....

    Note:

    GoonBox - rectangle invisible object and acts as the enemy, contains all the variables

    Goon - contains the actual animations of goon/enemy, only purpose is animation

    So I run right when the value is "Left" and run left when the value is "Right".

    It still doesn't work. It still makes the enemy keep running right regardless of where I (player) am.

    It's either the first 3 events (in my previous post) are overriding the last 3 events OR the last 3 events just doesn't really work.

    Aside from the "for each" issue you brought up, are there any other mistakes I did in my events (in my previous post) ?

    Edit:

    I tried disabling the first 3 events, the enemy did not run left. So it's really about the last 3 events not working for some unknown reason.

  • First part (under comment) are 3 events for "Run Right", while the next 3 events below it are for "Run Left". Those are for the enemy's AI (chasing after player)

    The rule is for the enemy to run (right or left) towards player if:

    • player is 30 to 120 pixels horizontally away from enemy
    • player is less than 10 pixels vertically away from enemy

    The enemy is supposed to attack the player if they are within 30 pixels or less from each other, but that's not the problem.

    I think the condition encircled is not working. Enemy can run right, but can't run left (even if the player's x is less than enemy's x)

    X_DistanceFromPlayer - instance var that is always set to abs(Playerbox.x - Goonbox.x)

    Y_DistanceFromPlayer - instance var that is always set to abs(Playerbox.y - Goonbox.y)

    AI_Movement_Number = 3 means to run right

    AI_Movement_Number = 4 means to run left

    I would think my conditions are perfectly correct, but why is the enemy not running left when the intended conditions are met?

  • I'm trying to make a damage system (similar to fighting games) using my own idea.

    When I hit the enemy, I want the enemy to retrieve the player's 2 instance variables' values for attack velocity (X for horizontal and Y for vertical) while at the same time, I disable the gravity. This involves pushback, pulling the enemy towards the player, slamming down enemy and hitting up enemy (like an uppercut).

    Right now, I am trying first a simple pushback (enemy should move only horizontally, no vertical movement).

    Enemy has platform behavior of course.

    Notes:

    X velocity and Y velocity are instance variables of Player

    Facing is also an instance variable of Player. It is set to 1 if the player is facing right, and -1 when player is facing left.

    Now I did it by

    [quote:eb0bh0em]+Player's attack animation is playing

    +frame = 2

    -> set X velocity to 60

    -> set Y velocity to 0

    +Player is overlapping with enemy object

    ->Enemy: Set animation to Hurt

    ->Enemy: Set Vector X to Player.X Velocity*Player.facing (this means the attack should push in the direction the player is facing)

    ->Enemy: Set Vector Y to Player.Y Velocity

    ->Enemy: Set Gravity to 0

    The enemy moves (being pushed), but the problem is, even if I set the X Velocity to any number other than 60 (I tried a ridiculously high number like 5000000000), the enemy still moves the SAME DISTANCE. So that means, I don't know if this is actually working or not. I want the pushback velocity to be changeable (based on the X Velocity variable), since different attacks have different pushbacks.

    So should I use "Set max speed" or what?

  • I am making a fighting game platformer/side scroller game.

    So I have player "char1' (more players to be added later on), and many different kinds of enemies.

    char1 has several attacks.

    I want to make any instance of the different enemy types that I hit:

    • go up if i hit them with attack 1, damage is 10, makes enemy fall
    • push them if i hit them with attack 2, damage is 20, doesn't make enemy fall
    • slam them down if i hit them with attack 3, damage is 30, makes enemy fall

    and so on

    and on the other side,

    When enemy1 hits char1 (and other player type chars i will add in the future):

    • using attack1, any player will be pushed back, damaged by 10, not fall
    • using attack2, any player will be pushed up, damaged by 10, will fall

    I also want my players and enemies to be hittable even while falling in air OR when they are hit upwards (while moving upwards in air, JUST BEFORE they fall down in air).

    How do I code that in a standardized way (for both players and enemies)? like not having to repeat the same events again and again ?

    Please someone explain to me as clearly as possible. I can't understand the example of Danuyos. It's too complex.

    I'm already using families and hitboxes (for attack) and playerbox (as the "hittable body" of player)

  • ok. tried it. did not worked.

    I noticed something. Right now, the PirateWithBomb is throwing the bomb at a stairway. If the bomb falls on a lower ground level AND the PIratewithbomb is already in frame = 2 AGAIN, the bomb binds back to Piratewithbomb (and not play OnGround)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • also, another issue is when the PirateWithBomb is spawning the bomb at frame = 2, if I REMOVE the "Every X seconds" condition, the PirateWithBomb spawns like multiple bombs all at once.

    I just want a single bomb spawned at the first tick of the frame 2.

    Did I do it right?

  • No. The OnGround animation plays when the bomb has landed on the floor (which is correct). But the timer is starting as soon as the bomb is spawned.

    these are all the codes of PirateWithBomb

    <img src="http://neuropod.net/imagehost/uploads/f39ff3afdfe57b6a58e35264f82c5442.png" border="0" />

    Just to recap how it is supposed to work:

    Bomb is spawned at frame 2 (binded at frames 2 and 3). Bomb should NOT explode while in frames 2 and 3 of PirateWithBomb. Bomb is thrown upwards and then falls down on floor. Bomb should play animation OnGround as soon as it lands on floor. Bomb should start a 1-second timer to destroy itself and spawn explosion.

    The bomb should destroy itself and spawn explosion upon contact with playerBox anytime AFTER frames 2 and 3.

    Also, some other issues:

    • the bomb thrown already "seems" to go back to being bind to PirateWithBomb after it was thrown. I want the bombs (individually) to not be controlled/bind after frame 3 (or AFTER it was THROWN) of PirateWithBomb

    LittleStain

    What's a good replacement for platform behavior based on the intended use?

    Nope. The bomb is just thrown. It doesn't walk or jump. I have tried simulating jump to make the bomb go up, but it did not work, so I used vector X instead.

    I thought of using platform because I thought I needed the condition "On landed" or "Is on floor", but either of those don't work.

  • <img src="http://neuropod.net/imagehost/uploads/c2c5e7c0d791ca292c1619b51f2518e0.png" border="0" />

    Bomb is thrown by PirateWithBomb upwards then falls down on ground.

    What I want to do:

    I want the bomb to change animation to "OnGround" and start a one second timer before destroying itself and spawning explosion object.

    Problem:

    The explosion object is already spawn just as bomb is falling down (which I already counted as 1 second AFTER the bomb was spawned by PirateWithBomb).

    How can I make it work like I wanted it to?

  • what could I possibly use? Aside from using solid behavior, I have thought of manually coding events like using condition "object on collision with" but so far, my problem is what action to use

    LittleStain

    btw, I don't see you online in skype anymore. I have another question to ask.