Lou Bagel's Forum Posts

  • : i heard about the lerp function and i will test your code too

    I made a sample capx to demonstrate lerp() — much easier to show all the events than to explain

    Should be pretty self-explanatory but let me know if you have any questions:

    Lerp() Tutorial

  • Fixed the first part (with boolean/shoot and stuff, perfectly working.)

    But, I still have a problem with the scoring. I've tried the else stuff and it's very complicated and I don't understand.

    So i've found an other way to do it. I've added variable named state into my laser and my asteroid. So when i want to score I compare the state of the asteroid and laser.

    So, if laser.state = asteroid.state then it adds +2 ; if it's not equal it adds +1. The +1 thing is working but not the +2.

    The good things is, I know why but I doesn't know how to fix it. When I press "shift" or "ctrl" to set the red/blue color to my ship it is supposed to change the animation of my laser and change the color, it works, but in the same event it's supposed to also change the state of my variable (putting 0 or 1 dependings of the ship color) but it's just never change and I don't get why. :/

    There is a screen of my even sheet and my capx there : drive.google.com/open?id=0B6phdwDtsxJkTXN1RnU3TUYyMDA

    I just tried it out and I got +2 when my ship was red and I destroyed a red asteroid and if my ship was blue when I destroyed a blue asteroid. Did you get it working?

  • Which part are you struggling on?

    I'm not 100% sure of details about objects/families colliding with one of their own but have seen several tutorials/threads on it.... here is one

    Once you get the 'picking' sorted out it should be straightforward, right?

  • Something as simple as 'every tick' setting the 'scrollto' & adding the behavior to the player 'contain to screen' can get you started. But if you are completely new it would be best to go through a few tutorials first.

    Good luck!

  • This scenario is what 'families' are for but unfortunately those are not available in the free version.

    You can still achieve what you want by storing the info in variables and comparing.

    Pick closest objectA; store distance in variableA

    Pick closest objectB; store distance in variableB

    If variableA < variableB; attack ObjectA

    -Else; attack ObjectB

  • Boolean is just a variable that can only be "true" or "false". To create an instance variable (as opposed to global variable) you click on an object and add it via the properties bar (initially on the left).

    What I was implying was replace 'every 0.2 seconds' with 'ship.ready' (meaning boolean is true). Then add an action to that event that changes the boolean to false. To have it change back to true every 0.2 seconds add the timer behavior and create an action to start a timer. Then create a 'on timer' event that changes the boolean back to true. (you could use wait but will most likely lead to bugs in the future)

    This variable can be helpful in the future also for when game is paused or maybe ship gets stunned or something, just have to change the boolean to false.

    I understand your thinking on setting the animation before it is spawned, I kind of had the same lines of thinking at first. But remember how fast all of this can be processed but also was probably setup to actually process those actions at once.

    If you want to replicate that in construct you just need some sub-events, which are visually indented and work like a nested if, and the else command, which is in the system events. The else command will fire if the command above it fails. You can have multiple conditions but the else has to be at the top of them. It will be apparent if the else command is setup wrong.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • No it's not the behaviour. It's the "Scroll to X" system action.

    But it appears that the object I'm scrolling to is shaking rather than the "scroll to".

    I don't know what is causing it. It is moved by lerp.

    How do you have it setup?

    Doesn't seem logical...

  • For your code here outlined in red I don't believe it will create the desired effect.

    This is checking every 0.2 seconds to see if escape button is down. It is NOT activating when escape is down and pausing 0.2 seconds. With such short time it may not be noticeable if you hold down the button. But if you were tapping the escape button and it coincided hitting in between the 0.2 seconds then nothing would be happening. Suggestion would be to have a "ready" instance boolean or something similar.

    Also, I don't know what you are doing exactly, but not sure why you have the spawn a laser after setting the animation for the laser. I believe the way you have it the changing the animations of the laser will affect all of the lasers on the screen then spawn a new one that is unaffected by those actions. If you put the spawn before then the animation actions will only affect the spawned laser.

  • Zombie Game

    Wasn't too long ago that I posted here but a lot of visual/art updates since then so here it is again:

  • Slight Change to Aiming Bar Mechanics

    • Got rid of "Aim" & "Shoot" button
    • Tap on the quadrant of the screen you are on to fire
    • Tap on a quadrant of the screen you are not on to cancel fire and move

    Think this is a great help as your eyes stay closer to your target so you can catch the animation and also gets rid of the tiny tap target (where if you miss it you move across the screen).

    Planning on trying to find a better look for the bar. Right now am thinking to make it smaller, outline (maybe in white), and possible changing the arrow to crosshairs. I kind of like the green, even though doesn't make logical sense feels it matches the theme & art.

    Also, I need to stop procrastinating on redoing the movement animations! That is the main reason I haven't posted links to any demos or tests—too embarrassed of that movement and try to capture screenshots without him moving, ha.

    Note: Will probably reduce the size of the headshot bar—either I'm getting good or it is too big.

  • Events for New Targeting System

    I wanted to post again showing some of the events for my fellow Construct developers. I apologize as this post may be a bit unorganized, images won't cover all the events pertaining to this topic, and a lot of basic boring events in the images. But I decided to post anyway to throw some stuff out there to anyone interested and feel free to ask me questions if you want to learn more about it. Also, I hope to clean up and organize all of this once it is more finalized, so sometimes explaining it to others can really help clarify it for myself.

    So lets get to it:

    Pointer Movement

    I'll start with how the pointer moves back and forth across the bar as this is probably the most interesting part to other developers, even though it is really a simple lerp(). I'll start with the screenshot of the events:

    • So first off it is contained in a deactivated group so it will only run when desired.
    • Arrow has two instance variables: Speed and Position
    • Every tick Arrow's position is set to lerp() where 0 is left border box of the bar and 1 is the right border box.
    • The Instance Variable 'Speed' is added to Instance Variable 'Progress' every tick (with the dt to make framerate independent)
    • Everytime arrow reaches either end (0 or 1) the speed slows down, this is to give the bonus of making it easier the longer you 'aim', and the direction is reversed. Could have just multiplied by -1 but didn't want to risk it running twice and cancelling out so used absolute value. To make positive take the absolute value, to make negative take the absolute value and times by -1 Example: abs(-10)*-1 is still -10

    The other events below I won't really speak about as most are straightforward, setting position and visibility, etc. I use a lot of functions so it may be impossible to follow everything.

    I will highlight one thing: setting the width of bar1, bar2, and bar 3. These respectively are for head shot, body shot, limb shot/grazing shot. The size they are based on depend on the distance of the enemy which is passed as a parameter to the function. I plan on tweaking the formula later when balancing testing but is basically subtracting the distance and dividing by numbers to found when testing.

    Feel free to ask any questions as I know I didn't cover everything. Hope a few enjoy and find it useful

  • If you aren't using a movement behavior I recommend using lerp() — no plugins required.

    Create instance variables for StartingX, FinishingX, Progress, & Speed.

    Group(initially disabled)

    -Every Tick

    --Set Position to lerp(StartingX, FinishingX, Progress)

    --Add Speed to Progress

    -If Progress > 1 Disabled Group

    Then when its time to move you set the starting and finishing variables, set progress to 0 and enable the group. Presto!

  • If the only effect they have is visual you can make them invisible. Either have an event that selects all and makes invisible (i.e. on tab key pressed toggle visibility) or put them all on one layer and have the whole layer invisible.

    If it isn't just visible you could have an event that destroys them all every tick. Put that in a group and can toggle the group active/deactivated

  • Are you doing the art for this? Love the pixel art style

  • I want to make a suggestion to help but really don't understand the

    ...i want to make smooth, jerky movement - like jumping frog in my game

    You could use lerp() but I wouldn't use a static third variable—that smoothing wouldn't make me think of a frog jumping. I usually use lerp with instance variables so it looks like lerp(starting, finishing, progress) and put it in a deactivated group. Set progress to 0, activate the group where every tick add speed (another variable) to progress and when progress >= 1 deactivate the group.

    Of course you can do this a bunch of different ways. If it is a jumping look you are going for I made these blobs with custom movement and timers, and of course animations: