vee41's Forum Posts

  • I want to know if there is a condition which checks if all instances of an object are destroyed.

    From system-> compare two values condition: sprite.count = 0. That would check if any instances of the object exist. sprite.count is built-in variable that keeps count of how many instances of an object exist.

  • In the example my sprite object name is "LevSel" and the animations associated with that sprite are "Act1toCh1", "Ch1toCh2", etc. I have the Stop Animation set up to prevent the 1st animation from running before any touches happen.

    Unfortunately this does not appear to work. What am I missing?

    Almost correct, except for the above part! :)

    The idea is, that at your 'set animation' action you dynamically create the name of the animation you want to refer. So that would mean merging the touches variable as part of the created animation name.

    What happens now, is that you try to set animation name as "Act1toCh1" & sprite.touches, which seeks for animation called "Act1toCh11" (notice the extra 1, which is value of touches variable).

    What you want, is it to seek animation with touches variable replacing the last number. You can achieve it like this: "Act1toCh" & sprite.touches. So if your touches variable is 4, you would seek an animation called "Act1toCh4".

    This technique is not the most obvious or clear to use, but it's something I personally use very often. Hope this clears it up! :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • From objects conditions, select 'compare instance variable'. Select <= 20 and then add another condition with >= 30

  • Make few searches on forums/tutorials about PHP and AJAX. General idea would be that you got AJAX object in construct transferring stuff to PHP script that does the searching part, and returns the results to AJAX.

    Might work. :)

  • The error message suggest that you have a trigger (event with little green arrow) as sub event of a loop. Like it says, that is not allowed :)

    Without seeing the .capx, you need to move the conflicting event(s) away from loop of any kind.

  • Here is what I am trying to do: I have a sprite object with multiple animations and I need to figure out how to have an On Touched event play one of the various animations depending on the number of touches on the associated object.

    So you wish to play certain animation based on how many times the object has been touched?

    You could do something like this:

    sprite instance variable: touches = 0

    on touched sprite

    .. add 1 to sprite.touches

    .. set sprite animation to "animation" & sprite.touches

    I assume that you have named animations of sprite as animation1, animation2, animation3 and so on.

  • You have to pin the turret to the ship as well, check out pin behavior.

  • Check out the pin behavior, seems to be what you are looking for.

    Containers are meant for object sets, that live, die and operate together. So combination of those two should be what yo are looking for :)

    To make things more generic and easier to manage, look into placing your things into single object as a separate animation/frames or using families.

  • Here is an example:

    Evil sprites example

    You can use the same principle when checking collisions between family members.

  • Try this:

    Every 1 seconds

    .. block.opacity = block.opacity-40

    block.opacity<= 0

    .. block.destroy

    Fade behavior might also be of use, if you don't mind smooth opacity change. :)

  • I make game for mobile.i add large black sprite under of layer and i center layout so the screen looks like fullscreen many devices.

    As you can see force field out of layout.If i dont cut this anyway it will look some devices.I can hide this with another black sprite but i dont want many sprite for performance. <img src="smileys/smiley1.gif" border="0" align="middle" />

    Performance wise it might be your best choice (apart from scaling the layout/cutting the images). Place tiledBackground with background color over the edges and scale it to cover the area, single 32x32 or something sprite won't really give you any performance hit. :)

  • It works, but as loops run ALL of their loops in single tick, all of your prints will wait for the exact same 2 seconds before appearing. So as tutorial demonstrated, add 'wait loopIndex seconds' instead of wait 4, and you'll get one text every second.

  • You could cut the image. I guess the biggest question here is, why would you want to do it? Image going over layout borders is not really a problem in most scenarios, as it won't be seen anyway.

    You could also place some background colored sprites on top of it to hide the parts you don't want to be seen.

  • You need yo put event where you pick instance 1 to same level with pick 0 event.

  • vee41 - Is it possible to take the principle from getting an AI to walk around a room by turning to a certain direction because the walls were different sprites?

    By this I mean something like

    Leftwall is overlapping Topwall > (trigger once) create sprite at X: (topwall.X - 25), Y: (topwall.Y -25)

    25 is just an example number of pixels of course, and this assumes the origin point is very top left of the sprite.

    edit: for your second picture on the right side where the small box meets the big one the bottom section of the wall would need to be a left wall and the top portion a right wall.

    wretchedshark That was my first attempt, the main problem (which I forgot to tell in the initial post) is that it was a bit slower method than I had hoped for, and required quite many checks and positioning of objects on collisions.

    newt thank you, was not aware of those! Those would be useful in this scenario as well.

    What my current approach is, and seems to work somewhat decent, is to spawn sprite on each collision corner via imagepoints. After that I use an 'measuring sprite' which I rotate 360 degrees around the center of sprite at distance X. Whether this measure sprite is overlapping an collision or not, I can find the angle of surrounding solids. I seek for left and right collision angles, and position the sprite in between those via some basic mathemagics.

    Here is an visual masterpiece I drew to describe the solution:

    <img src="http://dl.dropbox.com/u/19921470/find_corners_solution.png" border="0" />

    I only need to run it once so performance is not an issue. It still feels a bit excessive, but at least it works. :)

    Thanks again!