Matei511's Recent Forum Activity

  • But the enemies into a family. Then have an event 'on family created, create HP bar'.

    brunopalermo thanks a lot guys! Works like a charm!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • i am trying to pin a hp to every enemy. There are several instances of enemies, and several types, how do i pin one hp bar to every enemy on the layout, and how do i make them spawn together? (Note: i need all hp bars to be instances of one object, but enemies to be different objects, with several instances) For example i have 5 instances of enemy A and 4 instances of enemy B i need 9 instances of hp bar , each assigned to one enemy, and i want them to spawn together

  • Hi! I had the same problem but after a while I solved it. Here is the link of my topic

    says it can't load the plugin , what version of C2 are you using? can you give me the link to where you downloaded the plugin from please?

  • I am trying to implememt ads to my game but it doesn't work. I have followed tutorials on the forum but i get an error when trying to test it in the engine and a black screen trying to test it on mobile. Disabeling any ad related events makes the game work fine.

  • I want to make a curve using square blocks in a top down game an i was wondering, performance wise, what would be the most efficient way to do it. The goal is to spawn rooms and spawn a curved tunnel connecting them. (Both the room and tunnel premade). Also what would be the most efficient way to spawn them ( at the start of the level it spawns random rooms with tunnels connecting them)

  • i followed tutorials online , made an admob account, copy pasted the ad unit id into the cocoon banner adds properties for android. For displaying them i have 2 events:

    "On start of layout: load a banner add" and "on banner loaded:show banner add" . when i try to run the game i get this error:

    "Javascript error!

    TypeError: this.banner is undefined

    http://localhost:50000/ATPAds_plugin.js, line 203 (col 13)

    This may be a bug in Construct 2 or a third party plugin or behavior - please report it to the developer following the bug report guidelines. Subsequent errors will be logged to the console."

    if i disable the 2 events everything works fine and running it on android works fine aswell. Looking at forum posts about the error, somoene said that the error is normal and it doesn't matter because the game will work when compiled. I compiled it on cocoon.io, added this plugin "AdMob native Ads for Android cocoon-plugin-ads-android-admob" and compiled it. i installed the app and it only shows a black screen. Help me please!

  • brunopalermo Guizmus thanks you all ! Can't believe the solution was right under my nose all the time...

  • The we need 2 consecutive actions, that you want to execute every time you need the player to switch target. It could be every 1 second, but maybe don't check this every tick, it could cost a lot if you have a high number of enemies.

    First action will check all enemies, and set a variable to remember what enemy is the closest. Let's call "EnemyID" (set to 0) and "EnemyDistance" (set to 1000000 to make this easier) the 2 variables :

    • For each object Y // we want to do this test for every enemy
    • EnemyDistance > distance(ObjectY,Player) // if the enemy we are checking is closer to the player than another before

    This will trigger a simple action that will set both variables, EnemyID to objectY.ID, and EnemyDistance to distance(objectY,Player).

    Once this loop is done, the variable "EnemyID" is set to the ID of the enemy that is the closest to the player. You can create a second action, that will select the enemy by it's ID using the variable, and ask the player to take it as target.

    i didn't quite get the last part. would you be kind enough to reformulate? I'm new to construct

  • so i have object x, the player, and 10 instances of object y , enemies. i want, on mouse pressed, for the player to auto aim to the closest enemy. Thanks in advance !

  • Add health bar to the same container where you have your bee and bee_box.

    If you place bees manually (in editor) on your layout, then simply put a bar above each bee. You need to follow the order in which they were created though - bar with the lowest UID place over the bee with the lowest UID and so on.

    In your event sheet pin health_bar to bee_box on start of layout (the same way as bee is pinned).

    That's it.

    If you create/spawn bees during the gameplay, they will be created with the health bar, because they are in the same container. You'll only have to pin it.

    Thank you, again

  • It's called ternary operator.

    So you have 2 lines:

    If dtp<=200 then set speed to 0

    Else set speed to 150

    You can write the same in one expression:

    Set speed to (dtp<=200 ? 0 : 150)

    dtp<=200 is a comparison statement

    ? means "if statement true then this value"

    : means "if statement false then this value"

    It's a nice little trick that can really help de-cluttering your code. You can use & and | operators , nest several ternary operators one after another and write long expressions like this:

    Set speed to (dtp<=200 | bee.IsFrozen ? 0 : (bee.IsSlowedDown ? 50 : 150))

    Set damage to (dtp<=100 ? 500 : (dtp<=200 ? 200 : (dtp<=300 ? 100 : (dtp<=400 ? 50 : 10))))

    & means AND

    | means OR

    i am running into another problem now i am trying to pin a separate hp bar over every bee. how could i do that. i tried using "for each bee" pin hpbar to bee but it pins all instances of the hp bar to one instance of a bee so i have a bee flying around with 3 hp bars that are weirdly positioned

  • It's called ternary operator.

    So you have 2 lines:

    If dtp<=200 then set speed to 0

    Else set speed to 150

    You can write the same in one expression:

    Set speed to (dtp<=200 ? 0 : 150)

    dtp<=200 is a comparison statement

    ? means "if statement true then this value"

    : means "if statement false then this value"

    Thanks a lot, you are very good at explaining

    It's a nice little trick that can really help de-cluttering your code. You can use & and | operators , nest several ternary operators one after another and write long expressions like this:

    Set speed to (dtp<=200 | bee.IsFrozen ? 0 : (bee.IsSlowedDown ? 50 : 150))

    Set damage to (dtp<=100 ? 500 : (dtp<=200 ? 200 : (dtp<=300 ? 100 : (dtp<=400 ? 50 : 10))))

    & means AND

    | means OR

Matei511's avatar

Matei511

Member since 30 Jun, 2017

None one is following Matei511 yet!

Trophy Case

  • 7-Year Club
  • Email Verified

Progress

8/44
How to earn trophies