justifun's Forum Posts

  • keyboard on "shootbutton" pressed

    (sub event )system (every X seconds) -> create bullet

    you can tweak X seconds to anything you want.

  • So you want to check them all at once?, in that case put your "check" into a for each (ordered) loop.

  • That's a good way to to do it. I would recommend for good clean programming to take out the hardcoded random(11) and random>=8 and change those to variables such as explosionChance and explosionChanceRange.

    The put those variables somewhere like a blank sprite off screen where you can store game wide variables or use global variables. Then you always know where to find those values if you want to tweak them in the future.

  • 1) all you have to do is check for specific conditions and then apply whatever animations etc you want under each condition.

    eg: Add an event that has Keyboard left arrow is pressed, and add a second condition (right click-> add condition) and pick keyboard up arrow is pressed.

    Now those actions will only occur when both keys are pressed. Rotate the wheel's or play a different animation direction or whatever. Do the same for the other possible key combonations you want.

    2)I can't see the capx right now at work, but it sounds like you just want the car to scale depending on what area of the screen its on. Simply add a "system every tick" event, that scales the car based on its Y postion on the layout. You might need to get fancy with the math to make it scale nicely at any height. I suck at math so perhaps someone else can help with that.

    3) use "on layout start" -> set animation to "standing animation"

    ideally put that event at the beginning of all of your other events.

  • In the part where you have Raycast -> on collision with ninja (event 11)

    That's going to trigger all baddies to spawn and throw a ninja star. you need to create a subevent that picks only the instance that was filtered by the raycast, so that only one the specific ninja throws it.

    ill check out the capx when i get home

  • Yeah you've got it correct.

    the variable will be objectname.varname

    so for example

    system every tick -> No action

    (sub event) system compare instance variable enemy.numlife <1 --> destroy

    now any time a enemies life = 0 it will get destroyed.

  • On collision -> set bullet speed

    using "set animation" changes which sprite animation is playing, not the speed of the bullet

  • Tweaked the file and emailed it back to you.

    I've added a "sightrange" variable to the TUSK object (this is the range that the enemy will be able to see before attacking.

    then within that range, he will play the attack animation

    you will need to try and figure out how to do damage now to the player. Give it a try and report back if you need any help.

  • First create several different types of platforms you want the player to land on while running.

    next, using the system (every 1 second or something) to spawn new objects.

    Set their X position to just beyond the .x of the layout of the screen so that they will start off screen.

    Next use a system every tick event to move the platforms back in -X towards the player at whatever interval you want (probably a variable that will increase over time to speed up the buildings.

    Then lock the player's jump so that its only up and down and they can't move left and right.

    to separate the platforms so that they get created at a variable distance, set that original random timer you used to spawn the platforms to a setting like random(5) seconds. This way, some will be further apart and some will be closer together. Make sure the maximum distance apart isn't too big for the player to jump though. Also you will probably need to add another variable to that as the speed increases because the gap the player crosses will get bigger and bigger as the speed of the platforms come towards them.

  • right click your event and choose "system" -> "trigger once while true"

    also, right click your event and choose "add sub event"

  • Here's a follow up.

    1) Create a instance variable for the enemy called "sightrange" - give it a default value like 20 (in the properties field on the left)

    2) add new event

    type: system

    "every tick"

    for the action choose "enemy sprite" - set value

    Then in the next dialog box pick your variable "sight range"

    Now create a new event

    system - compare instance variable

    pick "sight range"

    and change the expression to "<" (less than)

    and where it says 0 right now, change it to distance(self.x, self.y, player.x, player.y)

    substitute "player" for whatever your called your player sprite.

    Then in the action for this new event put something like "set animation" to "attack"

    or whatever you want your enemy to do when the player is close

    now each time the player gets with whatever "sight range" default value you give it, it will execute those actions

  • Yeah, like whiteclaws said.

    Create an invisible sprite and pin it to your character, and put the scroll to behaviour on that instead.

  • To have the enemy attack from a distance you need use the distance() expresssion

    distance(x1, y1, x2, y2) Calculate distance between to points

    so in your case

    system - every tick - compare distance(player.x, player.y, enemy.x, enemy.y) < 20

    ----do actions

    2)

    For the enemy characters turn off the property "has control" if you are using the platform behavior on it.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Its super simple. Just use the "count" feature

    scirra.com/manual/133/common-expressions

    Compare the sprite count to 0 in your case and if so, goto next layout

    System "Every Tick> - Compare Sprite.count is equal to 0

    goto layout 2