BluePhaze's Recent Forum Activity

  • I just re-read your initial question and realized you have already gotten as far as I have most likely. So sorry if I wasted your time with my reply. There must be a way to pull it as they have a list that is hooked up to the keypress action. Unless they are pulling them from an array or something...

  • I played around a little after reading your question and came up with a partial solution:

    Create a global variable called keyPressed

    Then create an event for Keyboard any key pressed

    what I do then is the following in my event sheet:

    Keyboard On any key pressed System Set keyPressed to Keyboard.LastKeyCode

    Then I have another action in the event that sets the text of a text object called keyPressedText to the keyboard lastkeycode like this:

    keyPressText Set text to keyPressed

    This does what I want, the only issue is that the value of Keyboard.LastKeyCode is a number that represents which key was pressed, if anyone has a way to actually get the name of the key. I guess you could always create an array of the keys and their values and pull from it based on the LastKeyCode... hope this helps a little....

  • The above also has the benefit that as long as they are not holding down the run button it will set their speed back to the regular speed you chose.

  • Here is how I have it setup in my Event Sheet, I am very new to construct 2, so if anyone has a more efficient way let me know. My background is as a developer so I am used to writing it in code as opposed to event sheets. Here is how my event sheet is setup:

    I have two global variables in my eventsheet:

    Global number playerRunSpeed = 600

    Global number playerBaseSpeed = 330

    I then have an event for the player holding the run button:

    Keyboard B is down Player Set Platform maximum speed to playerRunSpeed

    System Else Player Set Platform maximum speed to playerBaseSpeed

    It doesn't matter if they have the left or right arrow down, as long as they have the B button held down, the maximum player speed is set to my run speed. If they are not moving this doesn't do anything, if they are moving they get the new maximum speed. You can also play with this a bit by setting the acceleration, etc... as needed if you want them to not instantly be going max speed when you hit the run button. I have also attached a screenshot of how it looks in my event sheet on skydrive, but as I am new to the scirra site I cannot post links yet. If you want me to send you the screenshot via email or some other method just let me know.

  • Just wanted to check is there a reason for not using else in construct 2? I am not a construct classic user, I come from a .Net programming background so am unaware of any issues carried over from the previous version of construct.

  • What I have been doing for this is just to make some adjustements to my event sheets. I created 2 variables, one called playerBaseSpeed and one called playerRunSpeed. I set playerBaseSpeed to whatever my normal walking speed is, and playerRunSpeed to whatever my running speed is, in my case base is 330 and run is 600. I then have an event for my run button keydown event where if it is down the speed is set to playerRunSpeed, else it is set to playerBaseSpeed. This seems to work well for me so far. The next thing I need to do is set the animation speed when he is running so the legs moving matches the new speed a bit better.

    This has a few benefits, I don't have to alter my keyleft or right events since the Run button (in my case B) handles the speed changes as needed. Also I can add extra logic later for example what if I have a powerup that ups the run speed even more? Then I can have an event that says if speedPowerUp is on, set playerRunSpeed to 900, else set it to 600. This gives you a lot of flexibility. You could also create constants for basespeed and runspeed if you want, then in your events you could just reference those if you don't see a need to change them.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks Kyatric, that makes sense now.

  • Ok, I think I have it, the tutorial has you assign the bullet movement behavior to the monster. I believe in the final solution they did things differently and did not assign this behavior. In mine I need to access it via monster.bullet.speed instead of monster.movement.speed

    Any feedback on which one is the preferred method? How would I get it to utilize movement instead of bullet?

    Thanks,

    James

  • Hello All! I am working through the Ghost Shooter and have finished the tutorial but am looking to add more functionality. I downloaded the completed version that is linked at the end of the tutorial and am having an issue, there is a behavior on the Monster object when it's health is equal or below zero. A system action that adds Monster.Movement.Speed to Score. The event sheet on my own project will not recognize the Movement piece. I can type Monster. and get a list of available behaviors but Movement is not one of them. I get Angle and a bunch of others. But not movement. So I cannot get the value of Monster.Movement.Speed even though I can see in the properties pain that there is under Behaviors section an property for Speed.... what am I missing. Even if I try to copy the action from the finished sample, I cannot paste it into mine as it still says it is not a recognized behavior.

    Any thoughts?

BluePhaze's avatar

BluePhaze

Member since 20 Dec, 2012

Twitter
BluePhaze has 1 followers

Connect with BluePhaze

Trophy Case

  • 11-Year Club
  • x2
    Coach One of your tutorials has over 1,000 readers
  • x2
    Educator One of your tutorials has over 10,000 readers
  • Email Verified

Progress

14/44
How to earn trophies