nimos100's Forum Posts

  • Each object have a collision mesh or mask, whatever you want to call it, and if they are overlapping the condition will be true. Its a bit easier to explain if you take 2 sprites, and open them in the C2 paint editor. In the left side at the bottom, there is a collision button, if you press that, you can see the collision mesh for the sprite.

    You can manipulate the collision mask here, or you can right click the sprite, and choose set as box I think its called and it will make the whole sprite a collision mask, or you can choose guess collision (Cant remember the name) and C2 will base the collision mask on what is in the image. Guess collision is only really useful if your sprite have transparency.

    When you use the overlapping condition, its not the actual sprite or whats painted in it, that it uses. but the collision mask. So if two of these mask overlap the overlapping condition will be true and whatever action you have specified for that condition will be triggered.

  • Hmm then I think you might be better off just using an "every tick" with a Set sprite.x = sprite.x + 2 or whatever will hit the exact conditions you need.

    Or you can add a check that will set the sprite to the correct position you need after it reach it.

    So if "Bullet distance travelled >= 100" -> Set sprite.x = 100. And if you need to make it more dynamic, just store the sprite.x start position, and calculate what the new condition should be, based on that. So if its every 100 pixel.

    You can compare the starting condition to the sprite current position and divide it by 100 and multiply that with 100.

    So instead of sprite.x = 100, you make it:

    sprite.x = Round((Starting_position + sprite.X)/100) * 100

    However depending on which way the sprite is travelling you need to change the + to - I think, to make it work.

    So if its travelling left it needs to be:

    starting_position - sprite.x

    And if its travelling right it needs to be:

    starting_position + sprite.x

    At least I think it will work. But math aint exactly my strongest point to be honest, so it might be wrong as I haven't tested it. :D But you can probably see if it works if you do it that way.

  • X is a variable

    X = 0 or whatever value you need it to start at.

    Try this:

    "For X to 100"

    ---"For 0 to 10"

    ---"Do whatever in the inner loop"

    Add 1 to X

    (You can just add a blank event underneath the inner loop, and it will run when the inner loop is done.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • My problem, well its not really a problem, I was just wondering if it was possible or whether I did something wrong :D

    Because I have something that needs to be check for whether its a weapon or not, if its not a weapon it should do something else, and in case its a weapon it needs to check if an equipment slot is free, and if its not it should just do the same as if it were not a weapon. And it would just be a lot easier to just make combine AND/OR conditions to check it.

  • Your condition is wrong, since its really difficult to make sure that your sprite (Bullet) hits and exact integer factor. The chance that it will hit exactly 100 is very slim. You can just change the "Bullet distance travelled" to "Bullet distance travelled >= 100" and then it works.

  • Not sure if im missing something, but isn't it possible to do AND/OR in same event level?

    Like

    Color = yellow

    Figure = Square

    • OR -

    Color = Red

    Figure = Square

    If not then it would be nice to be able to do <img src="smileys/smiley1.gif" border="0" align="middle" />

  • Don't know if its possible now, or even possible at all, but it could be great if there was a way to performance test individual events, functions etc. for CPU usage and maybe memory usage.

    As sometimes you might create something and it seems to work fine, but it might have a fairly big impact on your program, because of some minor thing that you didn't think of. So it would be nice if you could test each event somehow and that way figure out if you made some stupid thing or see if you can optimize it somehow.

  • Pretty much as stated in the Subject. Would be great for making full screen effects like rain, snow, fog etc. That doesn't use a lot of resources.

  • Just make an event -> mouse click object and select "car".

    Then do a check to see if the car is moving, think its called "Is moving" then "set speed 0" Else "Set speed = 100" or how fast you want it to move.

  • You can just spawn them from the object then they will be instances. So if you have made an object called "coin" just use either system -> create object "coin" or another object to spawn them.

  • There is a build in action to bullet behaviour called "compare distance travelled" or something like that, which will trigger whenever the bullet have travelled a certain distance. Have you tried that?

    Also In your example you use self.x, doesn't that keep changing the original X position of the bullet, didn't you mean to test if the bullet have travelled 100 pixel from its starting position?

  • They are already recognized as that, I think.

    If you create 4 sprite_1 and use a pick all sprite_1 that would select all 4 instances. If you then apply some action to sprite_1 it will be done to all of them.

  • I have looked at your program, and im not really sure I understand what you are trying to do. But I think you suffer from the same problem as some of us also have experienced. Which I still find a bit confusing, as it seem a bit weird that sometimes it works and sometimes it doesn't.

    Personally I try as much as possible to avoid using "system create object" in functions all together. because of them not being available as I understand it before next top level, and it seem to cause a lot more problems than its worth.

    But if I understood you correct, I would change the program in such way, that you start by spawning all the blue dots in the start of layout. And then make an variable like "Blue_dots_spawned = 0". Then add an event that will trigger on "Blue_dots_spawned = 0" and in that event you set it to 1, so it doesn't trigger again. Also in that event, you can use a for each "Blue dot" and then do what you have to do in the event it self, or add a function call here, that can pass the UID of the blue dot, and do it in a function instead, if you prefer that.

    Now instead of using "System create object" to spawn the symbols make the current blue dot spawn them instead, and then destroy that blue dot afterwards. Then have symbol spawn the large yellow object, and add a if "yellow object overlapping blue dot" As you have already destroyed blue dots, that have symbols you will never select them. And then you can just add a pick random afterwards, and it will select a random blue dot, from those conditions. And then you can do whatever you want with that blue dot.

    Hope you understand what I mean :D

  • Just posted in my original post, that I already tried using a global variable, and it didn't work. Well if I add it in the on create event, I have to click it 2 times, to get an reaction from it. which is not really cool. But ill probably end up just accepting that it doesn't work, and make it some less user friendly way :D

  • I dont think it would make much sense to link the whole capx as its pretty complicated, and would take a long time to go through.

    But here are some screenshots of the ones that works and the ones that doesn't.

    This one fine.

    Pic 1 - Working

    This one doesn't.

    Pic 2 - Not working

    To explain what it is suppose to do, to make it a bit easier to understand. When the player right click an item that can be equipped, and the slot where its going to be equipped is empty, it will spawn an item and move it to the correct equipment slot, in this case "hands".

    What the generate item function does, is simply to create an item, based on the input, and drop it at player.x player.y position, then the idea is to store the item that was generated in the "Last_generated_item" variable. And then select it afterwards and do whatever it have to do. In this case it should move it to the equipment slot.

    However it wont do that, and just drop the item at the player position.

    In the first picture, its the same, except the item is moved to the player inventory, and that works fine. The trigger for that, is a left mouse click on a sprite button.

    I tried to add a global variable and store some kind of action here like "Equip_item_in_hands" and then in the on create function of the item, check if that variable is that, and then move it. But that doesn't work.

    So how you would create an object when you mouse right click, and then make it do something I cant figure out. So frustrating how picking objects works I think, I don't trust it <img src="smileys/smiley19.gif" border="0" align="middle">