Yann's Recent Forum Activity

  • Wastrel and you haven't even tasted them yet!

  • you can save the X and Y position of your object each tick in two private variables, and then

    if there's overlapping

    • > fall back the the previous position
    • > then randomly pick any of the 3 cardinal directions your object wasn't moving toward (loop three or four times)

       -> check each time if you won't run into a wall again (overlap at offset)

       -> and then apply and break the loop

  • +Monsters is overlapping region
    +Bat pick by UID Monsters.UID
      -> do Bat related things
  • Remember that the window size must be bigger than the layout size

    Actually, that's the opposite (:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • First, your road sprite aren't really well designed. You shouldn't split the road in half. You should create a whole section of road and also create intersection sprites of the same size. Here in your cap you can't create a T intersection for instance. Then you start to see that you'd need many more sprites.

    Second, one of the way to generate a street would be to create the road network first. By road network I mean simple 0 or 1 in your array to figure out if it's a road cell or a non road cell.

    Then you just have to spawn the road sprite and check their surrounding to display the proper frame.

    Now the algo to create such a road could be :

    loop until you can't find any available cell

    • > cell at X,Y = 1 (1 = road, 0 = no road)
    • > choose a random direction between (1,0) (0,1) (-1,0) (0,-1)
    • > if the next cell is a valid one (not already a road cell and not out of grid) set X and Y to it.

    But then you will have a simple path without branching. For branching you'd have to go back in the road you've made and check for other adjacent available cells.

    Anyway, look at some maze algorigthm you might find some good tips.

  • Your HUD is weird, why is you hudTowerSelectBoxes a pair of square?

    Explain a little more of what you want, a schematic can help.

    Also don't create another topic about the same subject, you'll make things harder since you'll have to explain your problem again.

  • First, you can't refere to an object by the name of its object type in a create action. So CreateObject varAvailabTowers.at(ROW,COL) at (X,Y) isn't really possible like that.

    However there's a work around: put all your different tower in different animation frame of the same object, and store this data in your array.

    I don't have enough information to really grasp what you want to do, but it looks like you have a map in your array that holds the position of some towers.

    So basically the creation process should look like:

    Global number gridX = 0  // X position of top left corner of the map
    Global number gridY = 0 // Y position of top left corner of the map
    Global number cs=32  // grid cell size
    Global number cols = 10 // number of columns of the map
    Global number rows = 10 // number of rows of the map
    + On Start of layout
    + For "y" from 0 to rows-1
    + For "x" from 0 to cols-1
      -> Create mapObject at (gridX + loopindex("x")*cs , gridY + loopindex("y")*cs)
      -> mapObject: set animation frame to map.At(loopindex("x"),loopindex("y"))

    If your mapObjects have some animation, you should suffix the animation name with an ID and use a private variable to identify the object.

    The last line would be changed to

      -> mapObject: set objID to map.At(loopindex("x"),loopindex("y"))

    Then you will just have to always play your animation like that:

     -> mapObject: set animation to "Attack_"&mapObject.objID

    With this technique you can not only place towers but any object you want to set (trees, bushes, rocks, etc) The only downside is that you can only have one object per cell (unless you use a 3D array for layering)

    That's all

  • R0J0hound

    Hehe! That's what I call an elegant implementation.

    I thought about representing cubes in 3 dimensions but I thought it would be over complicated to handle grouped rotation and local orientation.

    Looks like I was wrong.

  • My best guess if your bug happens in firefox, is that the button keeps the focus when you click on it then key input aren't received anymore unless you click somewhere outside the layout.

    Annoying behavior.

    Work around: make your own button with sprites.

  • Any way, That's my take in the rubik's cube idea

    rubiksCube.capx

    Need rex's function plugin

    demo

    Press SPACE to display face's IDYann2012-07-09 04:58:06

  • Also as you bought c2 you can try to use one of the sprite packs...

    (uh Ashley looking at your badge, you bought C2 too but not as an early adopter? :D)

Yann's avatar

Yann

Member since 31 Dec, 2010

Twitter
Yann has 5 followers

Connect with Yann