terence's Forum Posts

  • In the event below I'm finding that the Wait time is not being triggered based on instance variable. If I remove the Else conditions then it works fine. What's the correct way to use Wait with an If-Else block?

    On Key R pressed:

    Player - Weapon = "gun"

    set Reload gun animation

    > wait 2 seconds

    set ammo to 5

    set Idle animation

    Else

    Player - Weapon = "uzi"

    set Reload uzi animation

    wait 3 seconds

    set ammo to 10

    set Idle animation

    Else

    Player - Weapon = "AK47"

    set Reload AK47 animation

    wait 4 seconds

    set ammo to 15

    set Idle animation

  • sgtwombatstudios: your logic makes sense but am having trouble getting it working. See CAPX: sendspace.com/file/0ayn32

    RamPackWobble: your method gives a realistic arc, but I'd like to avoid creating separate sprites for the bounced grenade. Also I'd like to be able to modify the number of bounces without having extra code for each bounce, maybe using a function?

    Paradox, an example capx would be helpful to better understand what you're suggesting.

    ArcadEd: Which version of EaseTween are you using? Couldn't get your file open.

  • Yes, have set them to global variables. The target reticule still moves back towards the center the moment the right stick is released, as I guess the global variables are set to 0 as soon as this happens?

    When I try to set the player angle toward (Target.TargetX, Target.TargetY) after setting TargetX to OffsetX and TargetY to OffsetY every tick, the player doesn't rotate towards the reticule. The only way I can get this to work is if I use Set Angle To: angle(0,0,Gamepad.Axis(0,2),Gamepad.Axis(0,3)) but this snaps the player angle back to 0 on releasing the right stick.

    Not using ScrollX/Y as UI is on a separate layer.

  • keepee, thanks that addresses points 1 and 3. Any suggestions on point 2? I can't think of any way to get the target to stay in position (and therefore the player angle) when the right stick is released.

  • LittleStain, that's my goal. The mouse.x/mouse/y movement is what I'm trying to replicate.

    keepee, dividing by 100 works in cases where my layout matches the window size, but I'm facing a few issues:

    1. If my layout is much larger than the window size, the target stays within the top left of the layout and doesn't follow the player.

    2. When the right stick is not being used the target defaults to a position just off center of the window and the player sprite snaps back to a 0 angle. I'd like the target to stay where the it was last left (just like a mouse cursor) and have the player stay pointing towards that angle.

    3. The player angle isn't exactly aligned with the target. To set the target angle I'm using Set Angle To: angle(0,0,Gamepad.Axis(0,2),Gamepad.Axis(0,3))

    Any suggestions on how to address these issues?

  • That makes sense but doesn't seem to work as it should, using Window Width/Height, global variables or hardcoded values. I seem to get huge X and Y values when the right stick is moved, so the cursor immediately goes off screen.

    Updated CAPX: sendspace.com/file/uljgcd

  • For my top down game (twin stick shooter with left stick movement, right stick aiming) I'm trying to replace the mouse with the right thumbstick but can't replicate the following:

    On Event -->

    Player: Set angle toward (Mouse.X(0), Mouse.Y(0))

    On Start Layout -->

    Mouse: Set cursor from sprite <Target reticule>

    So the left stick controls the usual WASD movement, and the right stick needs to move the cursor around the screen so that the player angle follows the cursor (rather than rotate the player directly). So I need a way of mapping the gamepad axis to an X,Y position for the cursor.

    Linked CAPX is based on the example in this thread:

    scirra.com/forum/360-aiming-with-a-gamepad-using-the-right-stick_topic73154.html

    CAPX: sendspace.com/file/52lruh

    Any suggestions appreciated.

  • Concept wise it's similar to what I'm going for but your arc is from a first person perspective (large to small) whereas I'm looking for a straight top down arc (small - large - small). I'd be interested to know how you scale the balloons after throwing.

    The other things I'm trying to do for regular grenades that I guess don't apply to water balloons are multiple bounces and rotation.

  • In my top down game, I'm trying to create a realistic grenade which when thrown by the player does the following:

    1) Gives the appearance of an arc by increasing the size/scale of the grenade sprite then decrease back to normal size to give the appearance of height (rather than using shadows)

    2) Allow player to charge the grenade by holding down the mouse button, the greater the charge, the further the distance thrown and the greater the "fake" height

    3) Bounce off any solids (regardless of the fake height)

    4) Rotate the grenade sprite a random number of degrees while it is in the air on its origin imagepoint.

    5) Bounce the grenade off the "floor" 3 times before coming to a stop (i.e. increase and decrease scale 3 times, in smaller increments each time).

    6) Have grenade explode several seconds after being thrown and generate a short lived blast radius

    In the capx below I have items 2, 3 and 6 implemented but not sure how to go about items 1, 4 and 5.

    Any suggestions appreciated.

    CAPX: sendspace.com/file/pzx3q5

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • That works well. Thanks. I didn't use containers initially because destroying sprites in one destroys the sprites in all other instances, but making the unwanted sprites invisible is a good workaround. Hopefully it won't impact performance too much.

  • I have a top down game where each enemy is made up of several sprites, and the enemies follow a path based on one of the waypoint tutorials.

    I'm facing the following issues and not sure what is causing them:

    1. The z-order of the sprites pinned to the enemy sprite seem to change randomly

    2. Pinned objects randomly disappear

    3. Pinned objects (enemy legs and head) seem to detach from the enemy sprite and when this happens none of the events relating to enemies execute any longer (e.g. dying after colliding with player sprite).

    CAPX: filedropper.com/pintoenemywithwaypoints

    Thanks in advance

  • Capx file was very helpful. I see what I was doing wrong now. Using imagepoints for measuring distances also seems to work better.

    Thanks a lot.

  • I'd like to destroy the feet and disable the bullet behavior for only the enemy instance the player collides with.

  • No, I don't think the feet were the issue. The problem I'm having is that when the player and enemy sprites collide the feet (and other sprites) pinned to all other enemy instances are also destroyed. But the bullet behavior is correctly disabled for only the enemy instance that collides with the player.

  • One thing I forgot to put in the capx is that apart from the "Enemy" sprite the other sprites pinned to the enemy and player (such as feet) will have collisions disabled, so this is why I haven't selected enemy feet in the collision event.