mercy's Forum Posts

  • Okay, I got it working. Created a loop, which picked only turrets with certain private variables, guess it can be done with arrays too in case of unique ship structures. Then simply with a sub-event I compared Turret.Angle and with "set angle" set the turret angle. It turns out this way "set angle" affects only the turret on which the loop count is at the moment. Good!

    Managed to create an angle range with too loops, so the turrets don't turn inward, over ports of the ship. From this point on it should be an INI file, or:

    1. one row of turrets at left port

    2. other row for right port.

    3. few turrets on the bow

    4. few turrets on the stern

    And the angle-ranges can now be set for each row/group. Hmm..

    This means that I have to begin creating eye-catching graphics design - which has to get attention even in thumbnail size so people click on the screenshots and get hooked - with only 1-2 years of experience, which is not enough.

    Still, failure is not an option, onward is the only way! Albeit very rocky. The greatest task, making eyecandy, cannot be regulated with easy-made Construct commands. Steep slope. So many newbies are falling into the depths below, like me. Game industry nowadays seems like the Wild-Wild West.. :(( <img src="smileys/smiley18.gif" border="0" align="middle" />

  • I have a turret sprite, which I destroy at the beginning of the layout.

    At runtime 4 copies of this is created as can be seen above. I gave them private variables.

    Here is the problem:

    It seems, the created turret sprites' .Angle properties cannot be accessed via their private variables ?

    I want to narrow down the angle range of the turrets so they can only rotate away from the ship in a ~110? wide angle. The turrets must not turn toward the other turrets beside them, plus they must of course not turn inside, the deck the ship, so they cannot shoot their own destroyer's control towers into pieces.

    I want to get each turrets current Angle, compare and don't allow it to increase or decrease too much.

    Turret.Angle('ID')

    Turret('ID').Angle

    Turret.Value('ID') & Turret.Angle

    give errors.

    Here an "if" would be helpful, like:

    If (turret('ID').Angle > 320)

       Turret('ID').Angle--;

    Is there any way to access & compare private variables of created objects? I want a lot of turrets created at begin of layout so making and adding 50 unique turrets sprites by hand is not very flexible.

    I thought of maybe making a global variable, create a loop but i can't access the created objects properties AND private variable at the same time.

    I can only set its position by directly accessing the private variable:

    Turret: Set position to object MyDestroyer image point 'ID'

    "Compare angle" does not give access to the created turrets private variable so I could identify, which turrets angle should be compared.

    Compare private variable gives errors, when I try to give it

    Turret.Angle('ID')

    Turret('ID').Angle

    <img src="smileys/smiley19.gif" border="0" align="middle" />

  • Thanks for the idea, but I couldn't find the "Always" event in Construct v1.2. It would really be nicer with "Always"

    Edit: Found always among events. Thank You!

  • OK, I finally managed it. Gaaarrhhh..<img src="smileys/smiley35.gif" border="0" align="middle" /> Construct has a very original way of using private variables to move/handle objects created on the fly..

  • <img src="http://img143.imageshack.us/img143/7615/turret.jpg" border="0" />

    The turrets are created and placed okay. How to move them together with the starship now?

    Every tick do what? Couldn't find a command like:

    For i=1 to 4 Move_object(Turret.i, MyDestroyer.ImagePoint.i)

    ?

  • I'm confused. Can't seem to set up the turrets properly.

    Each turret has 4 sprite parts. If I want to have 5 turrets, must I create 5x4 sprites for all turrets at the beginning of the layout? pfff.. <img src="smileys/smiley7.gif" border="0" align="middle" />

    I want to position all 4 turrets (sprite sets) at different places.

  • Hey guys. I've got almost no past coding experiences so I'm having a difficult time thinking a solution for this.

    2. I can't for the life of me let my character stop moving when he hits an object.

    Here you are:   

    Bumping into the table from the Right side

    go around to the right side of the table with your character, keep a 1-2 meters distance, then press "A" and go toward the table, bump into it.

    To add another stop-command for the "S" key:

    1. Click on the thin purple space under the event that says "S is DOWN" so the whole event _and_ the thin space below gets orange

    2. Right-click that thin orange space

    3. Select "Add sub-event"

    4. Select your character sprite

    5. Click Next

    6. Select "Is overlapping another object"

    7. Next

    8. Click to chose select the sprite "Pokedesk"

    9. Done

    10. Add Action

    11. Select your Main character sprite

    12. Instance variables---> Set value Front 0

    13. Press and hold CTRL and click on the "Set animation to Front_Stop below", drag it above--> under the new "Set value Front 0" command.

    14. continue with the other directions.

    Nice graphics, by the way.

  • I have destroyer ships shooting at each other.

    The enemy destroyers have one AI and behavior script.

    These enemy destroyers have multiple turrets on them.

    Each turret has it's own set of sprites, events, AI, targeting, etc..

    (The turrets are set up without turret behavior so they are using some custom sprites for collision detection, etc..)

    How to best set up one destroyer ship 'template' (1 AI for destroyer + 1 turret w. behavior then multiply that turret on the ship) so that I can multiply these destroyers, spawning a second destroyer, which has all turrets set up like the first one and both are attacking the player ship?

    Should I create the two destroyers by hand, positioning all sprites on them for the turret-parts and so make them hard-coded? Like one bunch of commands would be Enemy_Destroyer_1,(on it the turrets with their own behavior) all hard-coded/hand-positioned and it moves, for ex. via global variables and create all Enemy_Destroyer_1..2..X by hand?

    Or is there a way in Construct v1.2 to set up one destroyer template, then just spawn two of this template at different battlefield coordinates, both ship's behaviors fully working, they can attack, maneuver, etc.. as was coded in the template?

  • Example.capx runs now in Firefox 5.1. Good job!

  • Okay, "for(Var i =".. then comes the error:

    Error: this.targetUID is not extensible Source File: localhost/Turret_behavior.js Line: 323

    Anyway, fixed it. Now turret behavior works.

    runtime.js

    But Fimbul will change the runtime, so this was only a debug exercise.

  • Error: assignment to undeclared variable i

    Source File: localhost/Turret_behavior.js

    Line: 256

    ==>

    Turret_behavior.js

    Line: 256 Col 1:

         for(i = 0, len=instances.length; i < len; i++){ //iterate through instances

    I wanted to fix these errors, but Fimbul is on top of it, you see it better through. Also I began to create my own turret behavior just to get hang of coding again, plus I need to create a slow custom movement for my destroyers.

    Thank You for the shortcut, Ashley!

  • By invoking major functions, check within range, etc. it gives gray preview in firefox 5.1.

  • We need sprite-pixel collision or maybe faster: polygon-collision. I draw a simplified poly around my ship-sprite, routine must detect if that area overlaps the enemy-sprite.

    Basically I decided to build my game upon collision between sprites, bounding box currently, so if You add something better, my game will work automatically nicer. :)

    Thank you.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Um.. If I add the turret behavior to my turret sprite, then add event for the turret sprite--> Check for object within range, then add action: Set turret target to "Ship" Preview windows goes all gray. If I delete the turret behavior, the preview screen shows the game finely.

    The turret behav. example capx also gives a grey preview window.

  • Man, this is impressive! Excellent work.