R0J0hound's Recent Forum Activity

  • Here is a way a bit different to what you were doing:

    http://dl.dropbox.com/u/5426011/examples17/selection_interface.capx

  • ut I heard that the performance is really bad on mobile

    It's always best to test it to see the actual performance as hearsay can be exaggerated.

    For moving objects you should take the manual into consideration:

    ou should also avoid pathfinding every tick, since this will cause extremely high CPU usage and also increase the amount of time it takes for other objects to determine their paths.

    https://www.scirra.com/manual/154/pathfinding

    You'll still end up having to calculate a new path periodically, but all you need to do is get it close enough to the player so it has a line of sight to the player. Then you can switch to a much less cpu intense behavior such as the bullet behavior, to close the gap.

    You could also try and do what gillis did and break the area up into boxes and make a list for every box of the best direction to get to any other box. It's a bear to setup as you'll basically be defining the path from every box to every other box, but once the game is running pathfinding will be very fast as it's just a simple lookup.

    http://www.scirra.com/forum/quadralant-pathfinding-optimization-solved_topic60379.html

  • I'm using the array as a queue. Values are added to one end and the other end is what is used and where values are removed.

    f either global variable is not equal to 0 --> add the angle expression to the arrayHere we know that some direction is being pressed, so the angle is added (pushed) to the front end of the queue. In simpler terms we are just saving the current angle pressed.

    f the array has 5 or more entries on the x axis (width) --> move to the back of the arrayYou have the first part right, but all it does is remove (pop) a value from the back end of the queue when there is 5 five or more values. This is limiting the number of angles saved to 4 by removing the extra values. The "back" is where we remove from since it's the oldest value.

    f sprite is moving in any direction ---> set animation to walk & int(add 360 to the back of the array, divide it by 360, and divide the remainder by 45) from current frameThis one is kind of two part. The bulk of the formula is converting an angle to the closest eight direction. Here is a topic that explains it pretty well:

    http://www.scirra.com/forum/sprite-movement-8-dir-troubles_topic47201.html

    The second part is what angle is used, which is the oldest value in the queue or the "back" value. The gist of this is we are effectively using the direction that was pressed four frames ago.

    f sprite is not moving ---> set animation to first sprite in animation, and then reset/empty the arrayWhen the sprite is not moving we want the animation to reflect this. Without this event the sprite would just walk in place. By setting the animation frame to 0 we prevent animation and use the image for standing. The effect of resetting the queue to be empty is not really noticeable and that action could be removed. I just thought it logical to fill the queue new every time instead of reusing existing values from a previous motion. But considering the time it takes to fill the array: 4 frames *dt ~= 0.07 seconds it's pointless as that's faster than human reaction time.

    And yeah that's the main character from Earthbound.

  • Since you can't change the collision polygon for tiled background objects, a solution would be to use a separate invisible object for collisions.

  • It does that since it's hard to release two arrow keys on the same frame.

    One possible solution would be to use the angle from a few frames back. The idea being that it's easier to release two arrow keys over a few frames than one.

    http://dl.dropbox.com/u/5426011/examples17/8dir2.capx

  • I get a grey game area and the browser hangs when I try to play games in the arcade that use the pathfinding behavior. I've tested in Firefox 19 and Chrome 26 and according to the javascript console in chrome the reason for the fail is it can't load pathfind.js. The error message looks like this:

    Failed to load resource: the server responded with a status of 404 (Not Found) http://static1.scirra.net/arcade/games/3969/pathfind.js

    Here are three different games I've tried with the same error:

    no capxhttp://www.scirra.com/arcade/example/2130/test

    no capxhttp://www.scirra.com/arcade/addicting-shooter-games/4182/space-threat

    with capxhttp://www.scirra.com/arcade/games/addicting-action-games/3926/go-faster

    If I download the capx for the last on it previews just fine in r123.2. My system is winxp/sp3

    Here is a relevant topic where two other people are having the same issue:

    http://www.scirra.com/forum/grey-screen_topic65219.html

  • kappie7

    For solid blocks give the tiles the solid behavior and set it enabled when the animation frame is 1 and disabled when it's 0.

    For the scrolling you can change event 5 to "scroll to sprite" or any other scrolling method.

  • That strategy sounds like it would work fine. For setting opacity back to 100% just put a "every tick set opacity to 100" event above the events that set opacity to 0.

  • The last bit uses the angle() expression, so the full expression would be:

    angle(0,0,joyx,joyy)

  • If you're getting a grey screen for your game in the arcade then it's a bug and you should file a report in the Bugs forum with all the relevant info.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Disable the "set angle" setting of the behavior. Then do the following to set the angle based on what directions were pressed last.

    global number joyx=0

    global number joyy=0

    every tick

    --- set joyx to 0

    --- set joyy to 0

    key up is down

    --- subtract 1 from joyy

    key down is down

    --- add 1 to joyy

    key right is down

    --- add 1 to joyx

    key left is down

    --- subtract 1 from joyx

    joyx not equal to 0

    or

    joyy not equal to 0

    --- set player angle to angle(0,0,joyx,joyy)

R0J0hound's avatar

R0J0hound

Member since 15 Jun, 2009

Twitter
R0J0hound has 157 followers

Connect with R0J0hound