farflamex's Recent Forum Activity

  • The wait command is one way, or you could add a timer to your player, which increases/decreases each tick/every x seconds or whatever, and then you can only shoot when the timer has reached a certain value. E.G

    Every tick : Player.ShootTimer - 1

    On key press :

    Player.ShootTimer <=0 : Shoot

                          : Set Player.ShootTimer to 30

    That's a coding approach, but the wait command should do the trick anyway.

  • Thanks. I was wondering if there was something wrong with the logic of checking if a variable is NOT a certain number during the picking process, but if your example works, then I can't fathom why mine doesn't. It's still picking the variable which is not selected, maybe I have to indent the 'pick' command or something.

    * Worked this one, it was an error in my code thankfully, the variables were being reset elsewhere. Doh.

  • I'm trying to pick a random object, from 50 objects, which has a certain variable set, but must NOT have another set.

    So I'm doing....

    Object Var1 = 1

    Object Var2 <> 2

    Pick a random Object.

    It's not working. It IS getting all the objects with var1 set to 1, but it's also occasionally grabbing objects where var2 = 2, which it shouldn't be doing?

  • I understand why you think several 'on start of layout' events seems messy, but in the end I had several anyway, just to split up the amount of stuff I need to do at start-up.

    This situation with needing to set variables for objects on a new top-level event has caused me lots of headaches, but there's always a solution.

  • It's the thing I still find most aggravating about C2, but the link explains why it's necessary. You get used to it, basically you just find ways to create your objects in one event then manipulate them in a new top-level event. 'On created' usually solves it but other methods, such as your top example also do the trick.

  • I'm confused about ViewPort. I hadn't noticed this until recently when I added a start-screen to my game. The stuff doesn't appear where it should appear. For example, if I put an object at 0,0, it just appears near the middle of the screen, which is wrong.

    Somehow I seem to have not noticed this in 4 months of programming. My main screen is using WindowWidth and WindowHeight to calculate positions, and I'm using Crop-mode and scaling everything myself. It works fine, and 0,0 on my main screen corresponds to the top-left.

    ViewPort on the start screen just looks totally wrong, it has strange coordinates like the top left is at -448,-89.5. And if I get the centre of the screen with VPL+VPR/2 it gives 512. Since my screen window is 1920 pixels wide, I don't see how 512 is the centre of the screen (although if I put something there, it DOES appear in the centre, I just don't understand why).

    I'm not sure if this is important. My main screen works fine with my scaling and coordinates, on several browsers. I guess I could just work out what's happening with the start screen and use Viewport coordinates.

    * I am seeing partly what's happening. The left coordinate is -448 and the right coordinate is 1472. If you add 1472 and 448 you do get 1920, which is the correct width of the screen. I guess what's confusing is, why is my main screen working with 'normal' coordinates and the new screen isn't.

    * What makes this really confusing is, on my main screen, I position everything around the player ship (the ship stays in the centre and everything moves according to your position). That probably solves most problems automatically, but what I don't understand is, why can I place the ship at WindowWidth/2, WindowHeight/2 and it DOES appear in the centre. But when I do the same on the other screen, it doesn't? Apparently the VP coords are the same on both layouts.

    * After a bit of dabbling I think I understand why the two layouts are working differently. My player ship has the 'scroll to' behaviour, meaning everything centres around it (I think). Apparently the whole layout behaves differently when one object has that behaviour. I made some text with the 'scroll to' behaviour on the start screen, and now the whole screen works with 'normal' coordinates (i.e 0,0 is the top-left now).

  • By multiple lines of text, do you just mean a line of text, then another line underneath, stored in the same object? If you are, then you can just build your text object with 'Line 1'&newline&'Line 2'&newline&'Line 3' etc.

    Not sure if that's what you meant. Actually that saved me a lot of objects because I had 10 text objects ontop of each other and realised I could just stick them all in the same object with a newline between each line.

  • Hmm yeah, you're right, that should work I think... thanks.

  • I'm sure this should be easy with a simple while loop but I can't get it working.

    I have 50 objects, which have either a 0 or a 1 in a variable, let's say it's called 'Value'. I want to choose one of them at random, which contains a 0 in 'Value'.

    I was thinking...

    While

    Pick a random 'Object'

    Object.Value=0

        Sub Event - Do my stuff.

    But that's not working, not sure if picking in a 'while' works as I'm thinking it does. Or maybe there's just a much simpler way?

  • Forum is deciding to make my life hell tonight as well, dunno if you can follow that link.

  • Try Construct 3

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

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

  • Don't ask me why but it's refusing to allow a link to the image of the program. Oh well.

farflamex's avatar

farflamex

Member since 7 Oct, 2012

Twitter
farflamex has 15 followers

Trophy Case

  • 12-Year Club
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • x2
    Popular Game One of your games has over 1,000 players
  • Famous Game One of your games has over 10,000 players
  • RTFM Read the fabulous manual
  • Email Verified

Progress

18/44
How to earn trophies