robinw326's Forum Posts

  • 5 posts
  • Thank you very much for your replies,

    I really was reading the manual, but as zenox98 said, I've just skipped it, while reading it. Sorry for that, but thank you for your hints!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi!

    Just a short question about random number generation. First, please take a look at this line:

    Every 0.1 seconds, this line converts a randomly generated number, between 0 and 3, from float to int... or does it not?

    My question was, why it nearly never will reach number 3, while you observe it.

    Am I right about this? -The number will nearly never be three because the computer is generating floats that will be rounded down to a whole number. Which means, the computer cuts down everything behind the period (for example: 2.3764763547 = 2 or 0.4657623846 = 0). This means, that I need to set the variable to int(random(0, 4)) to get a 3 by times.

    Am I right?

  • Thanks for your reply.

    In the meantime I was able to solve the issue. It worked out, like you said. There was no problem with the collision detection of family instances. I have overseen a mistake I made in some earlier conditions. Here is my event-sheet:

    Don't be irritated, I have balanced out some values. As you can see in the section player_weapon_behaviour / Collision effects , there are some disabled lines of "code" which caused a conflict. They were there for the creation of a spark-effect, that appeared when a bullet was hitting an object. All objects that should cause this spark-effect, were put into the family fam_colliders_bullets, which also included the terrain objects. This must have caused the conflict. When this condition is disabled, everything works as it should.

  • Hello there!

    I am becoming desperate about a problem, I have with bullet collisions on instances of family objects. First of all, here is a screenshot of my creation in action:

    Nothing special, as you can see: A Top-Down-Shooter.

    The world is randomly created. At time, I have created two families for the creation of the foliage:

    fam_foliage_trees

    fam_foliage_rocks

    Inside are different sprites. Each sprite shall have different properties. In my particular problem: I want to assign random health-points variables to each instance, via giving the whole family an instance variable:

    family instance  varibale name: hp
    value: random(5, 10)[/code:3vc5p7fp]
    
    When the health-points drop to zero, the object instance, I was aming on, shall be destroyed.
    In my main event sheet, I included the following "lines of code":
    
    [code:3vc5p7fp]on created -> fam_foliage_rocks -> set value -> fam_foliage_rocks.hp -> random(5, 10)
    spr_bullet -> on collision with fam_foliage_rocks -> subtract from fam_foliage_rocks.hp -1
    system -> every tick -> compare value -> fam_foliage_rocks.hp "less or equal" 0 -> destroy[/code:3vc5p7fp]
    
    Problematic results:
    [ul]
    	[li]Every instance of fam_foliage_rocks objects now have the same randomly assigned health-points.[/li]
    	[li]If they drop, all instances of the objects, belonging to fam_foliage_rocks will be destroyed.[/li]
    [/ul]
    The game will be filled with a lot of more objects / families and stuff to interact with. Because the stuff should mainly be randomly generated, I will be encountering this problem very often. I searched the tutorials, forums and a lot of external results, but still haven't found a proper solution.
    
    Questions:
    [ul]
    	[li]How can I assign random variables for every instance of family objects?[/li]
    	[li]How can I affect (destroy) only a specific instance of family objects?[/li]
    [/ul]
    I hope you can help me out.
  • Hi!

    My name is Robin. I am 31 years old an live in a rural part of Germany. I am interested in programming since my childhood, but never had the endurance to keep on learning. This has changed with Construct 2. The software keeps me motivated and everytime I am programming something with this great thing, I can make a progress.

    Cheers!

  • 5 posts