PixelRebirth's Recent Forum Activity

  • I tried the following-

    + System: Always (every tick)

    + System: For each puzzlecubes

    + System: puzzlecubes.Value('x') Equal to puzzlecubes.X

    + System: puzzlecubes.Value('y') Equal to puzzlecubes.y

    -> puzzlecubes: Destroy

    but it didnt work?

    Can anybody help me with this?

    Sounds like it should work. The always event at the beginning is completely unnecessary btw.

    Are you sure the puzzlecube objects reach the correct positions? I mean maybe they end up being at 552.3467 instead of simply 552? Maybe try it like this:

    + System: puzzlecubes.Value('x') Equal to round(puzzlecubes.X)

    + System: puzzlecubes.Value('y') Equal to round(puzzlecubes.y)

    Other than that, show a cap!

  • You could simply have a string containing all your words with the default delimiter.

    car,fence,loophole,bat,cigarette,opium,bottle,wheel,...

    Then if you used the gettoken expression like so

    Gettoken(string,4)

    would return "bat" in case of this example. Get it?

    You could insert a random word easily into sentence for example:

    "He opened the trunk and there it was: a giant "&Gettoken(string,Random(Numtokens(string)+1))

    The Numtokens expression counts the number of tokens, the plus one is there because the Random expression is 0-based.

    Hope that helped!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I've tried using left(global('name'), 1) which works fine but I can't seem to get the 2nd letter in the word using left(global('name'),2 returns the 1st & 2nd letters in the word.

    Yeah well, you need to use the MID expression here!

    Mid(string, index, N)
        Returns the N characters after index in string. [/code:3fh2qrg1]
  • I think this issue is important enough to go a bit into detail about it, so here you go:

    We Construct Blog - Forum rescue #002: Timer

  • You really need to do understand picking. In your case you're using the Wait object, well, you're out of luck. A wait action breaks all previous picking. Therefore all instances of the object will be affected.

    As an alternative I would suggest using a private variable, calling it 'Lifetime' or something else that makes sense. You set it to an inital value of 5000 to get the 5 seconds you want (I like to measure time in ms), then have an event that always substracts 1000*TimeDelta from that PV.

    Have another event that destroys the object when the PV is <= 0, and there you have it. A perfectly working 5 second timer without any picking issues.

  • Try adding a File object to your project. It has an action 'Execute file'.

  • Wow awesome thanks ! any ideas on that?

    We all know that one minute has 60 seconds in most cases. With that knowledge, some basic math and a few expressions you should be on the safe side!

    http://dl.dropbox.com/u/2306601/acountdown2.cap

  • There's not much you can change about the button object, I'm afraid. You should try the sprite button plugin, which is more customizable. Or make your own buttons simply with sprites and some events.

  • I?m trying it for 2hours now with no results

    We all started out small, no worries.

    Take a look at this cap: http://dl.dropbox.com/u/2306601/acountdown.cap

    Enter a number in the edit box and click on start to let it count the seconds until take off!

  • adds value 1 to the variable all the time and not just one time as i wish it would?

    The 'Is checkbox checked' condition will be always true if any instance of the button is checked as long as you don't use other actions to pick instances accordingly. So it will always add to the variable. This is NOT a bug.

    To do an action for all instances of an object equally, it sometimes requires a For each loop. Take a look at the following cap, which (hopefully) works like you want:

    http://dl.dropbox.com/u/2306601/buttoncheck.cap

  • As far as I can tell there is no easy way to bring one sprite from one layout to the next without destroying it in one and creating it in the next. In the process you lose all that objects private variables. Now of course the easy way to remedy this would be to change all those private variables into global ones

    Yes, there are global variables for that purpose. You can also make an object itself global, in which case it will automatically exist in every layout up from the first you originally included it.

    It comes down to carefully designing your game. You should be aware which variables need to be carried over in between layouts and use globals, global objects (array, hash) or even the S plugin.

    Problem solved right? Well what if I want to conserve the sprites animation, speed, angles etc. from one layout to the next? That would mean I would have to (right before switching layouts) retrieve all that information and store them in a bunch of global variables in order to effectively recreate my sprite the way it was right before the layout ended and we went onto the next.

    You could keep track of all that with variables like you say. But if it comes down to many different variables/states that need to be remembered, you probably should try to use some kind of data structure (again array, hash, S), as it may end up being less of a hassle.

    If that is the most effective way to do it then that is alright by me-- my only question then would be, how do you get the position of an object relative to another?

    I think the best method of saving a relative position may be simply to remember the angle and the distance between the objects in question. So you can set the relative position of Sprite2 to Sprite1 with using cos/sin.

    Set Sprite2.X to Sprite1.X + cos(SavedAngle)*SavedDistance

    Set Sprite2.Y to Sprite1.Y + sin(SavedAngle)*SavedDistance

  • a) Will the S Plugin do what I need, saving a mixture of numerical and text data to a binary file, and allow me to load it back?

    Yes, the S plugin is the single best choice for the job. I'm mostly using it for the purpose of saving/loading and generally for level editors, which it can simplify enormously. Also it can actually save objects, not only values and strings.

    b) Is the S Plugin finished and stable, and can it be relied on in a game?

    It's not finished, but in an absolutely useable state, basically like C0.x itself.

    You may experience many crashes while trying to get the hang of S. Simply because in case you're trying to manipulate an array that isn't created yet, or misspell the array address, S will simply crash the runtime in most cases.

    But in fact I do rely on it in different projects and it works like a charm.

    If you carefully look through all the examples and explanations lucid gives in the plugin thread, you should be able to use S in no time. This is a particularly useful post for example:

    http://www.scirra.com/forum/viewtopic.php?f=2&t=4791&start=40#p38861

PixelRebirth's avatar

PixelRebirth

Member since 26 Mar, 2008

Twitter
PixelRebirth has 1 followers

Trophy Case

  • 16-Year Club
  • Entrepreneur Sold something in the asset store
  • Forum Contributor Made 100 posts in the forums
  • Forum Patron Made 500 posts in the forums
  • Forum Hero Made 1,000 posts in the forums
  • Coach One of your tutorials has over 1,000 readers
  • RTFM Read the fabulous manual
  • Email Verified

Progress

23/44
How to earn trophies