R0J0hound's Forum Posts

  • You need to use the "pick by uid" condition of "block" instead of the system condition to pick an object instance.

  • You don't need an array for this. Use a Sprite for the blocks as you said and give them an instance variable for the state. You can then make the grid of blocks by placing them in the editor or with events.

    global number grid_top=10
    global number grid_left=100
    
    start of layout
    for "row" from 0 to 9:
    for "col" from 0 to 9:
    --- create block at (loopindex("col")*block.width+ grid_left, loopindex("row")*block.height+ grid_top)

    Then you can do the targeting by saving the uid of a random block to a global variable. Then with events only check for bullets hitting that instance.

    global number target=-1
    
    target = -1
    pick a random block instance
    --- set target to block.uid
    
    every 1.0 seconds
    pick block with uid target
    --- "have the enemy shoot at block"
    
    pick block with uid target
    block is overlapping bullet
    --- destroy bullet
    --- subtract 1 from block state
    
    block state<=0
    --- destroy block
    --- set target to -1
  • Try Construct 3

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

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

    My canvas plugin can be used for dynamic images and per pixel collision detection. It's not as simple as it could be but here are all the examples I could find:

    http://www.scirra.com/forum/how-do-i-simple-worms-game_topic47872_post300449.html#300449

    http://www.scirra.com/forum/destroy-Objects-parts_topic61035_page2.html

    http://www.scirra.com/forum/destructible-terrain-better-ideas-than-this_topic55053_post344054.html#344054

    Two of those have some kind of terrain generation if that helps.

  • was wondering if there is any compendium of the Construct syntax...

    http://sourceforge.net/apps/mediawiki/construct/index.php?title=Expressions

  • Allow me to disagree about the difficulty of a turn based game. The state of who's turn it is can be represented in a variable. Then use the variable compare condition in events to control when things happen. That is pretty much the main aspect that makes it turn based.

    After that you can tackle each other aspect individually. The computer AI will be the most difficult but is doable.

  • Do you mean you want to spawn a random object out of a set of objects?

    If so you could use the "create object by name" action and use

    {"man", "woman", "monster", 

    "kid"}cvc@(random(4)+1)[/code] as the object type.

  • Well it would appear that find() does case insensitive searching, so "a" is the same as "A". So we have to work around that. Dictionaries have case sensitive keys so we can use that.

    First populate the dictionary with all the keys:

    global string chars="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-.,:;'""?!()"
    start of layout
    repeat len(chars) times
    --- Dictionary: add key mid(chars,loopindex,1) with value loopindex

    Then change the formula to:

    Dictionary.Get(mid(Text.Text, loopindex, 1))

  • Arima

    I would like to eventually but I don't have much time as of now to do it. WebGL is straightforward enough but I will need to study C2's renderer to get it to work with effects. When I made the plugin webGL wasn't even on the table so with the 2d canvas most of the features were a piece of cake to implement. Getting it working with the webGL renderer is a lot harder and time consuming than "a piece of cake". It's more accurately somewhere between "a three course meal" and "an all you can eat buffet".

  • I made a bubble shooter capx a while ago. It also found connected bubbles with a flood fill algorithm. It only did it when a bubble landed as there is no reason to do it continuously. I also thought the lag to not be a problem because of when it occurs.

    Some ideas to make it faster:

    1. Lookup the capx I made and see if my implementation of flood fill is more efficient than yours.

    2. You could limit the amount of lag by doing the flood fill over multiple frames.

    3. As a last resort you could come up with some type of data structure to make the flood fill more efficient by making the picking of a bubble's neighbors a simple lookup instead of a collision check against all the other bubbles. In theory it will be much faster, but it will require a lot of events and be very tedious to setup.

  • Savvy001

    Just added save/load function. Re-download from first post. It is likely to be slow with larger images.

  • It's done the same way. The order of the animation frames should be like this:

    "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-.,:;'""?!()"

    or have what ever characters you wish to use. Then change the expression to not use lowercase():

    find("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-.,:;'""?!()", mid(Text.Text, loopindex, 1))

  • You could use the 3dObject and change the textures with the texture Setter plugin and see if you get better performance with that.

  • I managed to get something working with python.

    http://dl.dropbox.com/u/5426011/examples17/ffmpeg.zip

    It extracts frames to a file and then loads it into a sprite. I'm getting about 15 fps on my machine.

  • There isn't a simple solution to this.

    I was looking into solving this when I made the python examples and I didn't like how much work it looked like it would take to do it the correct way. AKA writing a plugin using directshow. Besides that solution my thought is the problem boils down to two things:

    1. Read a frame from a video

    2. Get that frame to a texture so that Construct can draw it.

    One (1) is easy, there are many python libraries that can do this. Two (2) is the problematic step. Existing ways in Construct to draw video aren't drawn by Constructs rendering engine but instead are drawn by other means to a child window. That's why the video is on top and has the side issue of not having a texture that textureSetter can get.

    One idea I have is to use python with pyffmpeg to read individual frames from a video and write them to a temporary file. Then load that file with the "load frame from file" action to a sprite every frame. This may work but will kill the framerate because of the constant hardrive (hd) access. This could be helped a bit with a plugin and saving and loading a file in memory to avoid hd access.

    Even if it's working to that point it's not going to be optimal. Loading a image to a texture stalls Construct's renderer, and still there is the audio of the video to deal with.

    SHORT ANSWER:

    The solution is to write a plugin to do it, which will be time consuming.

    or use existing methods and scratch the need for the video to not be on the top.

  • The project is likely being loaded just fine but no editor windows are opened. Construct saves the ui state when saving so it is possible to load with no open windows.

    My original post still stands as a solution.

    This is what I meant by project toolbar:

    http://sourceforge.net/apps/mediawiki/construct/index.php?title=Project_Bar

    Another solution is to delete the .persist files in the same folder as the .cap. All a .persist stores is the ui state so it can be safely deleted.