not sure what's wrong

This forum is currently in read-only mode.
From the Asset Store
2D fighting template based in the game that defined the fighting games genre.
  • the object moves a little bit but that's about it so i'm not really sure what i'm doing wrong so some help would be nice

    <img src="http://i163.photobucket.com/albums/t294/vinnyang/movement.jpg">

    P.S. i think my brain is turning into mush

  • And what's the problem. Nothing moves?

  • oh yeah ... forgot to mention that XD told ya my brain was turning into mush LMAO

  • Just some quick thoughts.

    Remove the keydown checks in the loop. No need to check them again.

    Must agility always be greater or equal to zero? Otherwise you could let key left make agility < 0, and then in the loop just have .X + agility

    If not, you could have a private the_direction variable that you set to 1 or -1 depending on if you press left or right arrow key, and then in the loop use it as so: .X + (agility * the_direction)

  • well the agility acts like speed in determining how many times the loop needs to run so it must always be 0 or greater (there should be an event resetting agility, i just haven't added it)

    the subevents in the loop determine the direction

    so the idea is that with a higher agility, top speed is reached quicker (speed is capped by preventing agility from increasing beyond a certain number) and the loops are there for pixel perfect collision detection (i just haven't added the conditions for collision yet -_-' lol)

  • How about instead of using a loop you just move the sprite like so:

    <img src="http://xs222.xs.to/xs222/07513/noloop.jpg">

    If agility is 3 then it'd move three pixels, which is the same as moving one pixel three times in a loop. Unless you're using the loop for something else, that is.

  • moving a sprite 3 pixels once and moving a sprite 1 pixel 2 times are 2 different things when it comes to collision detection which is why i do the movements in the loop.

    without the loop it would check for collisions every 3 pixels whereas in the loop it would check for collisions at every pixel which is especially important when sprites start covering larger distances in a shorter amount of time

  • why not do a for loop where the maximum number of loops is the agility and in the loop you only move one pixel at a time?

    Although i suppose a repeat agilty times would also suffice no?

  • hmmm, the for loop seems to run itself automatically ... =S lol

    could you explain it a little further? i'm not really sure how i would go about accomplishing this with a for loop <img src="{SMILIES_PATH}/icon_razz.gif" alt=":P" title="Razz" />

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • okay, i've gotten off my lazy ass and tried something else and it worked so either i don't know how to properly use sub events or i've managed to find a bug <img src="{SMILIES_PATH}/icon_razz.gif" alt=":P" title="Razz" />

    this is what i did

    • deleted the sub events under the left and right key is down conditions
    • made a new event:

    + Key Left arrow is down

    + Sprite2.Value 'agility' Less than 10

    OR

    + Key Right arrow is down

    + Sprite2.Value 'agility' Less than 10

    : Sprite2: Add 1 to 'agility'

    that encompasses the same idea as before but for some reason it works this way and not the other

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)