R0J0hound's Forum Posts

  • 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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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)

  • Instead of having a different sprite per image use one sprite with many animation frames and an animation speed of 0.

    Another idea would be to design the levels with this:

    http://www.mapeditor.org/

    and import them into Construct with one of these:

    http://www.scirra.com/forum/topic59982.html

    http://www.scirra.com/forum/plugin-tmx-importer_topic49949.html

  • This topic covers shuffling cards but it is applicable:

    http://www.scirra.com/forum/randomized-an-array-for-a-deck-of-cards_topic45833.html

  • Here's a few ideas:

    1. Utilize a formula to do the same thing as multiple events. As a simple example instead of doing this:

    variable = 0

    --- set variable to 1

    else

    --- set variable to 0

    Do this:

    every tick

    --- set variable to 1-variable

    2. Use functions if you are using the same thing in multiple spots.

    3. Use third party plugins or make your own.

    4. Make your own scripting language that you run using the 100 events and put the scripts in the instance variables of the objects.

  • The % operator would be useful in this situation. It gives the remainder after a division, so if a%b = 0 then a is divisible by b.

    Here is one event way to do it:

    global number toFactor=28

    global string factors=""

    start of layout

    repeat toFactor times

    system compare toFactor%(loopindex+1) = 0

    --- add loopindex%1 & " " to factors

  • Have a look here for one solution:

    http://www.scirra.com/FORUM/bubble-shooter-ball-colisions-placement_topic62091_post381423.html#381423

    Basically i used a instance variable for each bubble that tells is it's connected or not. If a bubble touches the top of the layout or another bubble that is connected then it is connected.

  • Create all the sprites beforehand and make them invisible. Then make one visible every click:

    On mouse clicked

    sprite is invisible

    pick sprite closest to (320,240)

    make sprite visible