lennaert's Forum Posts

  • Sisyphus

    Yep, i am guessing the whole missed actions is a bit of a myth which finds it's origin in incorrect expectations.

    lennaert Your examples are poor. There is no reason a Wait 0 is needed in your function example, and the reason Wait 0 doesn't work in this example is because the Trigger once, which is an abuse of Trigger once, will prevent x=2 from being evaluated. The X=2 condition would nee to be a subevent of x=1 to work with Wait.

    Wait 0 is rarely required.

    That depends on whats in the function meh, blackhornet.

    But you are right, the examples might seem poor to a more advanced developer as they would not need it nor require it.

    But there are quite a few here which do not understand the use and mis-use it....

    The trigger once execution was actually a very good example in demonstrating the working of wait(0) .... whether it is useful or not was not really the point.

  • Ohw you should add the collision detection in the event with the for each loop

    event

    on collision

    for each enemies

    state = "patrooling"

    sub events

    etc

    and

    for each enemies

    state = "waiting"

    sub events

    etc

  • webgovernor

    *nudge*

    UPDATE: I realised that this is because of me using the play at object action...

  • after sprite rotate 10 degrees toward 0 add an action set variable rotate = 0

    I could explain how using the wait 0.5 second is not the smartest way to handle this ... but seeing as your in a learning curve ... I would just go with the rotate = 0 and follow up with events and actions after that

  • enemies state="wait" will require a "for each enemies" loop above it to handle multiple enemies individually, otherwise it will control all enemies when 1 has the wait state.

    Same goes for enemies state="patrooling"

    ie

    event:

    for each enemies

    enemies state="patrooling"

    and

    event:

    for each enemies

    enemies state="wait"

    Ideally, you have both the compare statements below 1 for each enemies

  • lennaert Yeah, when you need to postpone actions till the end of event sheet it's okay, but what about skipped actions mentioned by ? Have you ever noticed this?

    I never noticed missed/skipped actions really.

    But I think this has to do with the approach and intended use.

    Like, the following example:

    Global variable x = 1

    -event: Trigger once

    sub event 1 condition x = 1

    -action wait(0)

    -action set x = 2

    -sub event 2 condition x = 2

    -action browser plugin execute js "alert('x is now 2');"

    with the wait(0) disabled, the popup shows.

    Enabled, it might look like it is missing actions

    Toggle the Wait(0) for clarification and restart app.

    example capx

  • My usage of wait (0):

    In the same event, to make sure previous actions are completed before the next actions after the wait(0) is processed.

    Example:

    event condition = true

    -action set variable x = call function meh (y,z)

    -action wait (0)

    -action set variable a = variable x

    In this example, variable x is set by means of the process in function meh.

    the wait (0) forces the process of the function in order to set the variable x to be completed before moving on to the next action.

    Thus variable a will always be set with the result of function meh which was moved into variable x before the wait.

    In short, the wait(0) allows the previous actions of the same event to be completed prior to moving to the next actions after the wait(0).

    I avoid relying on the wait(0) when it involves a different event, or even a sub event of the event using the wait(0) as its unreliable and merely makes the entire event sheet wait 1 tick before processing further where it was, making it loose data and information or picked objects.

    At least that's how I always see it.

  • OK, I understand the problem with a browser game. But what if a game is released as a nw.js exe, or as a mobile app? Is that still something to be concerned about?

    Sorry if I'm derailing the thread.

    At its core, it's all just javascript.

    The browser plugin was a simple example, simple in the meaning of "click to download addon, and add script" Literally under 5 minutes.

    Mobile apps are generally wrappers or webviews ....

    nw.js is an exe wrapper kinda thing ....

    so basically yeah .. they are all just as susceptible to various standard manipulation.

    Potential solution to the problem mentioned, use instance variables on objects where the important variables do not have too obvious names and make sure you use the minimizer which obfuscates the code and variable names even more

    And same here, apologies for the derailment, if you have further questions regarding the issue, please make a thread and I might reply if needed.

  • > FYI, Regular global variables have rather huge security issues.

    >

    What exactly is meant by this?

    Simple example, say you have a global variable "score" and actually call it "score", and someone with something like greasemonkey* or tampermonkey* addresses the variable "score", is then freely able to manipulate it with whatever he or she wants ....

    * = simple browser plugin which allows you to directly inject javascript to any webpage as if it was part of the original page, in this example, your game.

    See the potential issue when users can determine their score so easily ?

  • Now I don't think you understood the purpose of writing down what you want in your game before making it.

    It's called software requirement specifications.

    which would only work if you know exactly what you want.

    Which is general not the case with indy developers who produce games on the fly when getting tons of ideas from things they pick up along the way.

  • Are there no ads which run on a web published game? This would work on any platform in almost any browser. :/

    There are various add companies offering web page adds which you could use in a framing context; either as a layer above your game as an iframe, or the frame sizing you can set/choose when exporting.

    But these require you to embed a bit of code from their sdk's; generally a bit of javascript and html which you can place in a project file an d then load this project file in the desired frame.

  • Well the OP wanted a method so he doesn't have to repeat the same code over and over. Because a global variable isn't encapsulated , then he can just call it easily whenever he needs to without having to repeat code over and over.

    The only thing in my opinion that brings a mess to a large project is not writing down want you want 1st. Before I take on a larger game I write down in notepad the different scenarios and things I want in the game. That way I don't get stuck in the middle because I calculated what I was going to do.

    Actually, the OP did not want anything, it was more of a rant.

    FYI, Regular global variables have rather huge security issues.

    Writing down anything related to your project is fine ... but .. what happens if you have 5k events ? or even more ...

    Exactly, a notepad will do near nothing to assist in readability or maintainability on that front; Groups and Structured sheets is the clue there.

  • Hi,

    Indeed, for PHP to work you need an interpreter (PHP). It is a separate program.

    The syntax actually resembles javascript quite a bit, but it requires its own engine to run.

    It does have some greater advantages over Javascript when you want to do file manipulation.

    PHP is often used as a back-end system for databases and information management systems.

    Good luck, and if you have any questions regarding PHP feel free to ask.

  • Welcome to add hell

    You might be better of looking for an add implementation for each platform ;0

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • > mahdi71, you been around long enough and build more then enough to know various limitations.

    >

    > Why has it suddenly become an issue to rant about ?

    >

    > Also,

    >

    > >

    > > so yes c2 is not so fast after all . and its really not good for big projects.

    > >

    >

    > That construct 2 is not so fast is more a matter of personal opinion here I think.

    > To me it is one of the quickest development tools around.

    >

    > And handling large projects is just another skill set you need to acquire.

    >

    hi, its not an issue .

    people here think i said it can't be done, but i said its just take alot of work for a thing wich can be done by a drag and drop !

    just read what i write then tell me if i wrong.

    people here answer me with a "lol" becuase they really dont have an answer, i said this things can be done but with much work. just that so i dont need an capx example

    Haha, some of the replies were rather short sighted; users glancing your trophies, post count and member status.... and go 'meh must be n00b'.

    However, if they took a moment to look at your posting history ^_^

    The things you mention, yes, some are tedious, and can be overcome in various matter.

    A short sum up:

    UI requires a similar approach in all projects to be easy portable.

    I would recommend a creation approach; event and actions building and placing ALL the UI elements from an objects-container-layout. (1 layout holding all the objects initial objects)

    This way you could easily copy paste an object for UI objects to another project's objects-layout, and copy paste all the events associated with that.

    Families;

    Remember that with families, you can still create the object using the original object name, and in the same action refer to them as the family object in order to manipulate the family values.

    Reusable code, well, methods above mentioned show it certainly is possible, its all in the approach.

    To retain an objects instance variable, remember you can set objects as global too, just make sure you correctly manipulate its position and visibility appropriately across layouts.

    I tend to use 1 invisible sprite somewhere in the top left with a load of instance variables, and the object set as global.

    The new local storage ... it just depends on how you use it ...

    You could set 1 local storage variable with a global object's instance variables by means of an ASJSON. (mentioned above) And also restore it.

    Thus you could save or load unlimited instance variables with a single local storage command.