AllanR's Forum Posts

  • orinab

    I am not a fan of wait actions. Because while you are waiting, you might need to change what should happen next.

    I made a quick sample of how I would "schedule" a next animation to play. There are two types of animations - looping and non-looping. You always want to change animations at the end, but looping animations don't trigger an On Finished event so you have to look for the first (or last) frame. I chose to look for the first frame because various looping animations could be different lengths. For animations that don't loop, you just need an On Finished event, and if no animation is scheduled while a non-looping animation is playing, then when it finishes, go back to idle.

    I figured that there may be situations where you just can't wait for the current animation to finish, so I made one that will always start immediately (the Die animation).

    You can get my sample here: http://www.rieperts.com/games/forum/AnimationSchedule.capx

    my sample doesn't queue up multiple animations... if the walk animation is playing and you quickly press jump and attack, it will switch directly to attack (or whatever the "NextAnimation" is set to when the current one ends). But if you want a queue, that wouldn't be hard to do.

    I was just discussing this with my son, and he reminded me that Spriter has built in animation blending - so you may want to check that out too.

  • luckyrawatlucky

    You could create a function to do that. Pass in the number entered by the user as a parameter, and then have the function pass back the string of numbers up to that value.

  • darkrealos

    the Every Tick sub event will only run on the tick when the mouse click event fires. You need to have it be a top level event. Set clickx and clicky to scrollx and scrolly at the start of layout so that it doesn't move the camera location until you click to make it move.

  • MomaFugger

    sounds like you have created an infinite loop

  • m0nkeybusiness

    The options are pretty limited - you can change the Type field of a TextBox to TextArea to get multiple lines (and then use CSS to make the background and border. Or use a sprite for the background and border and then place a text object on top of it. But then you need to know how much text will be displayed in advance, or resize the sprite after text has been set - using the TextHeight and TextWidth properties.

  • techkenb

    add another condition to the every random seconds that says sprite.count Less Than MaxSprites

    (where MaxSprites is the number you want to limit at)

    This will then only create a new instance of Sprite if there is less than the maximum number you want to allow.

    You don't need the Sprite.count greater than 2...

  • Rise 0f BETA

    that code only changes the camera's x coordinate, so to move diagonally, you will have to also change the y coordinate.

    There are plugins that can help do it - like LiteTween, or MoveTo. Or you can do it with Lerp, or just calculate how much to add to the y coordinate each step of the way.

    In your graph you are moving 7 units on the x axis, and only 2 on the y. So each time you change x, you want to change y by 2/7 as much.

    Edit: yeah, what oosyrag said!

  • I use groups and functions extensively. And I like my code to condense down to nothing. Any code I am not actively working on gets minimized. And if I am not using any of the functions in a group, the whole group gets minimized. The current project I am working on has 1374 events on the main eventsheet (and growing), but when I load the project, it fits on one screen. I arrange the functions in a group alphabetically, and I always start code for functions from a blank sub-event (so that when the function is minimized all you see is the function name. The first line in the function is a comment that lists the parameters to pass in. With a couple clicks I can expand exactly what I need to see - its very quick and easy to find things, and everything else is hidden. Groups are divided up by what they do: Touch, Mouse, Keyboard, Player, Enemy, etc... but they are mostly general purpose routines, rather than for specific states. I will normally have a global variable that determines the state and that controls what code runs.

    I hate having unnecessary code running. If nothing is happening on screen, then cpu utilization better be pretty close to zero. Only do what's needed - when it is needed!

  • Try Construct 3

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

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

    If you mean make another instance (with same name, variables, etc) then, you can hold down the CTRL key on the keyboard, and then click on a sprite/object and hold the mouse button down and drag an new instance of the object to a new location.

    Another way is to right-click on an object, choose copy, then paste a new instance.

    Right-clicking and choosing Clone object makes a separate object (new name, but same variables, animations, etc - as you know)

    If you mean a new object (with a new name) that looks the same, but not with the instance variables and animations, then you have to start from scratch.

  • You can also use "Self" inexpressions, which is like using a for each loop.

  • jobel

    If you have a web site to post to, you don't need any of the above. You just export to HTML, uplaod to your site, and run the C2 app in safari, and then choose to "Add to home screen", then it can be launched from an icon and works exactly as if it was wrapped - without the fees and hassle.

  • IJCT

    I like to use a sprite (called "Camera") that has the scrollto behavior. Then you can control how that object moves in relation to the player - have it over the player, or to his left if he is moving left so you see more of the direction you are going (and vice versa). You can limit its vertical movement while allowing the player to go up and down short distances without scrolling the whole screen unnecessarily...

  • I would be interested in hearing what people do as well...

    I have read that the official C2 steam plugin needs updating and that there is one in the store that works well for adding achievements, steam overlay, etc.

    I have also heard there have been issues with reviewers capturing game play, and that non Windows platforms may have issues

    but I don't know if those are old issues, or what versions work better than others, or what work-arounds people have tried.

  • MegaAntMan1

    I tried and played to level 3. The game finished loading without any error or getting stuck - so that tells me the assets must have loaded.

    these are the errors I get in the console when the game starts: (sounds like there is a problem where you set the size of the objects - and it is coming out non-numeric or something...)

    WebGL: INVALID_VALUE: texImage2D: width or height out of range

    GLWrap_.loadTexture c2runtime.js:3231

    (index):111 Failed to register service worker: DOMException: Only secure origins are allowed (see: https://goo.gl/Y0ZkNV).

    OnRegisterSWError (index):111

    117(index):1 [.Offscreen-For-WebGL-000001FB7FD0B350]RENDER WARNING: texture bound to texture unit 0 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.

    2c2runtime.js:3231 WebGL: INVALID_VALUE: texImage2D: width or height out of range

    GLWrap_.loadTexture c2runtime.js:3231

    4(index):1 [.Offscreen-For-WebGL-000001FB7FD0B350]RENDER WARNING: texture bound to texture unit 0 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.

    WebGL: INVALID_VALUE: texImage2D: width or height out of range

    130(index):1 [.Offscreen-For-WebGL-000001FB7FD0B350]RENDER WARNING: texture bound to texture unit 0 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering.

    (index):1 WebGL: too many errors, no more errors will be reported to the console for this context.

  • ome6a1717

    I have heard of people using C2 for making a web site (and have seen a couple examples), but it is really not suited for that job. There is no way for search engines to index the content - so people will never find you by searching. It is much more complicated to make it responsive (adapt to screen size and orientation). If you want a scroll bar, you have to make your own, loads slower (because of the engine overhead), and other issues.

    I use C2 to make apps that are launched from a web site (and interact with a database) - but they are for private use, not available to the general public, so SEO is not a concern.

    It is possible to make use of the whole screen (and center things), have a (custom) scroll bar, and make a nice looking interface... just not ideal for a typical web site.