JeremyBenson11's Forum Posts

  • I did that. Cursor over enemy unit was added after, as a secondary attempt. This only worked when solid was removed.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I just told you what the fix was. I removed solid, and it worked. It wasn't line of sight. I could be 5px away and it wouldn't click. Removed solid and it worked like a charm.

  • Problem Description

    Left click on object was not working until solid behavior was removed from the object. This is the only edit that was made to make this work. Not sure why.

    My action conditions

    on left button clicked on enemyUnit

    cursor is over enemyUnit

    playerUnit isTurn

    playerUnit isFiring

    not playerUnit hasFired

    player unit has line of site to enemyUnit.X, enemyUnit.Y

    Action

    playerUnit set mouseX to Mouse.X

    playerUnit set mouseY to Mouse.Y

    set destAngleX to enemyUnit.X

    set destAngleY to enemyUnit.Y

    set destAngleSet to true

    set rotateToDestAngle to true

    Debug readout on playerUnit

    isTurn 1

    isMoving 0

    mouseX 691.830985915493

    mouseY 58.59154929577465

    hasFired 0

    isFiring 1

    destAngleX 693.2717046230803

    rotateToDestAngle 1

    destAngleY 59.32356140793535

    destAngleSet 1

    Line of site for the playerUnit is 120px

    Steps to Reproduce Bug

    • Check to make sure your conditions are right.
    • If all else fails check to see what behaviors your using with mouse. Solid was the issue in this event.
    • Try removing the problem behavior if possible.

    Observed Result

    Clicking on the sprite would not register at all. Conditions were checked and double checked. Only removing solid fixed this issue.

    Expected Result

    Click on the sprite should set the variables mentioned above.

    Affected Browsers

    • Only tested in Firefox.

    Operating System

    Windows 8.

    Construct 2 Version ID

    R204.2

  • I've solved this. For some reason solid behavior was interfering with the mouse click. Not sure if this is a bug or not.

  • Hello,

    I've got a player sprite with a few variable on it, and an action I'd like fire if the user clicks on the enemyUnit. The problem is the left clicks are only registering if I click on the canvas. I'm not sure why this isn't working. Every single condition is met. Can someone tell me why it's not working? I really don't know. I've checked the other actions. I don't see where another action might be firing to mess this up. Any tips.

    Thank too. Just frustrated. There's unanswered posts, and not the first thing that's tripped me up, but might be my fault Thanks guys.

    My action conditions

    on left button clicked on enemyUnit

    cursor is over enemyUnit

    playerUnit isTurn

    playerUnit isFiring

    not playerUnit hasFired

    player unit has line of site to enemyUnit.X, enemyUnit.Y

    Action

    playerUnit set mouseX to Mouse.X

    playerUnit set mouseY to Mouse.Y

    set destAngleX to enemyUnit.X

    set destAngleY to enemyUnit.Y

    set destAngleSet to true

    set rotateToDestAngle to true

    Debug readout on playerUnit

    isTurn 1

    isMoving 0

    mouseX 691.830985915493

    mouseY 58.59154929577465

    hasFired 0

    isFiring 1

    destAngleX 693.2717046230803

    rotateToDestAngle 1

    destAngleY 59.32356140793535

    destAngleSet 1

    Line of site for the playerUnit is 120px

  • Sorry, I'm gonna bump this thread with a new event sheet. I really need someone to show me where my data is going wrong. I'm not understanding something. I'm trying to advance from simpler games to more difficult, but this player selection and movement stuff is confusing me. Someone please take a look at the image below and tell me what I am missing in understanding and flow of control.

    Objects on layout

    three playerUnits, a moveLocation

    playerUnit [isSelected = false, isMoving = false]

    moveLocation [uid = 0, isSelected = false]

    Basically for this example I would like to click a unit, move it to one of the moveLocations that pop up around it, and select another unit and move it.

    Bugs:

    Select a unit, the move tiles show up, select a different unit, the other units move tiles disappear, and the newly selected units move tiles show up. After the third unit is selected move tiles show up and the last units disappears. When I select any of the units again the last units move tiles disappear and the newly selected unit doesn't get move tiles.

    Second bug is I can't move. This happened when I added a Boolean condition, not sure which one. Before that the lerp was working but when I selected another unit as that one was moving it would stop moving. When I selected a move tile for the other unit that I just selected the other unit would move towards it too..

    Please help with understanding on how to order these programs. I can't seem to get out of simple stuff.

    Thanks,

    Jeremy.

  • Hello,

    I'm just trying to learn the tidbits it takes to make an RTS. Right now I'm just piecing together some bare bones elements. I've got the players and enemies. And a game engine, with one value. When a player clicks their unit some little squares show up showing where they can move. I've got an un-worked out lerp function, I'm not even sure what the lerp parameters are yet. Also when the player selects a unit the move boxes around the previously selected unit get destroyed.

    This is working pretty good, but there's a couple of issues. When the new units are selected the old units move boxes get destroyed as expected, but if the old units are selected again the move boxes don't get recreated.

    Thanks for your time.

  • To better suit the question. Is there an array of objects on the layout I can loop through, and access members and functions of those objects...

    for(key in objects)
    {
          if(key == 'name')  
         {
            if objects[key] == 'Cat'
           {
               // do this.
           }
    
       }
    }
    [/code:g49whr2a]
  • Hey,

    I'm wondering if someone can help me write a function. What I need to do is learn how to move objects that are already drawn on the layout. They would be placed there by the back end user. I think the function I'm writing would help a few people. It's really simple, and might be doable through events, but this one action plugin is cool. Maybe we could add to it for the other users. Likely one around, but what ever.

    Thanks,

    Jeremy.

  • Just wanted to show another image. If I append currentx to text I get 01 which seems to be right.

    I'm just so muddled. I know what I want, but not how to achieve it. I have an array of inventory items. I want to have an inventory grid where each square is the same as the elements of the array. So item at index 0 goes in the first inventory block, item at index 1 goes in the second..

  • Hey,

    I just figure out how to shift the values. Basically I swapped first index with last, deleted the old first index. This creates a looping effect when set to a button. Now if I click left button the array values shift in a loop. Right button would be reverse order... now. I'm wondering something else. I need to move and object from a position to a specific position based on a array key, but all I can find is current value.. I need something a little more robust...

    Take a look at this image..

    This isn't exactly what I need. I need to say if current index 0 move sprite with the name of value to such and such a place. Then if index 1 move sprite with name of value to such and such a place.

  • Hello,

    I know people get mad when posting without effort, so just to let people know I've read the FAQ, and saw the post explaining this but the capx files didn't work. The other solution for some reason was a data struct plug-in. I'm just wondering is there an easy way to shift array values around in Construct. Construct would benefit so much from a simple move elements left 1 or move elements right 1 command. Also index swapping would be a huge benefit.

    How can I learn to do these two things easily with an array? It would help my programming immeasurably. Scripting would be a good inclusion to. Like JS scripts.

    The creators of Construct 2 could add a swap action under manipulation in a matter of half a day...

  • Okay, there was a bug. I closed out construct and now setting the window size actually moves the dotted gray line. Thanks for your help . The only thing wrong is everything is off by a pixel in width. I set window size to 512, 512, and layout size by 512, 512.. then created a sprite and filled it. The square sprite set to 512x512 has a px of white space. it doesn't fill the window even though the dimension are the same. If I nudge the sprite to the right the white space shows up on the left. Not sure why...

  • Is there in-depth info on how all these numbers work. I've set window size to 512, 512.. and then in the layout I've set layout size to 512, 512 and margins to 512, 512. I would have thought that 512, 512 size would be the size of my window. But if I put a block in that canvas, covering the the whole 512 area, there's still white space.. I have to stretch the block to the right, into the grey, in order to actually cover fall the white of the screen in the browser...

    Is there a way to disable window sizing?

  • The image below will show what I mean by the dotted line being half on a tile.

    Another question I thought of was after reading the Rayman article. It said many designers use 512*512 images for backgrounds, to help with resource and memory management. The only thing is a 512 image goes above the canvas view.

    I never was real good with images and dimensions, but have learned a lot along the way. I just need to understand these specific problems.

    Thanks,

    Jeremy.