Object from point a to point b by animation

Discussion in 'Learning Javascript' started by ICF-Soft, Sep 7, 2016.

  1. ICF-Soft

    ICF-Soft Veteran Veteran

    Messages:
    209
    Likes Received:
    99
    First Language:
    Spanish
    I'd like to learn througth javascript how to make an ingame object go from point a to point b inside map by animation.


    It can be a sprite, an event, a projectile, a soccer ball, an annoying companion/follower, someone blocking my path, etc.
     
    #1
  2. Lantiz

    Lantiz Biterkid Veteran

    Messages:
    719
    Likes Received:
    1,066
    Location:
    Brazil
    First Language:
    Portuguese
    Primarily Uses:
    RMMV
    Hey, I think this can help you:
     
    #2
  3. ICF-Soft

    ICF-Soft Veteran Veteran

    Messages:
    209
    Likes Received:
    99
    First Language:
    Spanish
    No. It doesn't help.


    I want to throw things, nothing related to pathfinding.


    Also, I don't ask for a plugin. I want to learn things. 
     
    #3
  4. Lantiz

    Lantiz Biterkid Veteran

    Messages:
    719
    Likes Received:
    1,066
    Location:
    Brazil
    First Language:
    Portuguese
    Primarily Uses:
    RMMV

    Pathfind

    You can learn by yourself reading the code


    Hope you find someone to help.


    Cheers!
     
    #4
  5. ICF-Soft

    ICF-Soft Veteran Veteran

    Messages:
    209
    Likes Received:
    99
    First Language:
    Spanish
    I didn't said "make an ingame object go from point a to point b". I've said "make an ingame object go from point a to point b inside map by animation". It's not the same.


    Throwing things has nothing in common with pathfind. What thing do you think will happen when you kick a ball? Ball will go directly without searching for a path.



    This is a learning javascript board. I want to learn something about animation to use in my plugins.


    Greetings.
     
    Last edited by a moderator: Sep 7, 2016
    #5
  6. Andar

    Andar Veteran Veteran

    Messages:
    28,637
    Likes Received:
    6,578
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    @Lantiz, @ICF-Soft, please keep the tone civil


    The problem with ICF's idea is the way how animations work - if you're talking about animations in the database.


    They're basically sequences of pictures that are displayed on one specified coordinate - which means they can only go relative to that point, they can't go independently.


    If you're talking about something else, you need to give more details about what you want - because in that point Lantiz is correct in so far as that your descriptions can have multiple interpretations, and his answer is the correct one for some of those other interpretations.
     
    #6
    Alistair, Cunechan and Lantiz like this.
  7. ICF-Soft

    ICF-Soft Veteran Veteran

    Messages:
    209
    Likes Received:
    99
    First Language:
    Spanish
    I think that is better to ask for a better explanation than prove to be right by removing important conectors that change sentence.


    On first case I explain better what I mean.


    On the other case I explain why he is wrong.


    I didn't knew this sounds so bad. Sorry for this.
     
    #7
  8. Andar

    Andar Veteran Veteran

    Messages:
    28,637
    Likes Received:
    6,578
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    That warning was more a preemptive sentence to prevent this from deteriorating, not because anyone already said something bad.


    And while this is most probably caused by language barriers, you (@ICF-Soft) didn't really explain what you want. You used a lot of words that have either none or several meanings in the area of RPG-Managers (like animation can mean an animation from the database or a general technique for drawing something by javascript commands or something done as an on-map cutscene.


    Or, more to the point - there are only two things that can be moved at all on the screen - pictures or events. Moving a picture is a direct event command, and you can look up its javascript equivalent in the topic that lists all javascript equivalents to event commands.


    And if you want to move an event, that requires pathfinding (simple pathfinding if trough is on and passability is ignored, but still pathfinding).
     
    #8
    Alistair and Lantiz like this.
  9. Zalerinian

    Zalerinian Jack of all Errors Veteran

    Messages:
    4,695
    Likes Received:
    923
    Location:
    The Internet.
    First Language:
    English
    Primarily Uses:
    N/A
    I'm 90% sure they want to know how to smoothly move an object's x/y position to a different position over time, as in animating its movement across the screen/map/whatever, instead of having it be in one place and then instantly appear somewhere else.


    And an answer to that depends on what kind of motion you want. Linear motion is the easiest, but it's also rather unnatural. Looking around on google for animating something's position would help. What you're essentially doing is calculating a smaller part of the change in position you want to apply over a number of frames.
     
    #9
    ICF-Soft likes this.
  10. Tsukihime

    Tsukihime Veteran Veteran

    Messages:
    8,230
    Likes Received:
    3,067
    Location:
    Toronto
    First Language:
    English
    How should the object move from point A to point B?
     
    #10
  11. ICF-Soft

    ICF-Soft Veteran Veteran

    Messages:
    209
    Likes Received:
    99
    First Language:
    Spanish
    Well, I find frustrating when I request something and it goes to a 100% wrong point (on second line of what I request you'll find why) and still says is a right solution every time I say/explain why it isn't.


    So I say that a solution that involves pathfinding is far away of the solution.


    @Andar, you're close with "a general technique for drawing something by javascript commands or something done as an on-map cutscene" to what I want.


    @Zalerinian, you're even closer. I want to move an event this way and update position when finished, and to throw projectiles between players/events.


    Some examples:


    -There is a soccer ball that can be kicked by players. When kicked it does it's natural movement and updates when finished.


    -You are pissed about those party followers movement, so you grab one of them and throw him to another place.


    -An event takes a stone from the floor and throw it to another event.
     
    #11
  12. geovanie

    geovanie Villager Member

    Messages:
    5
    Likes Received:
    3
    First Language:
    English
    Primarily Uses:
    RMMV
    You're looking for something like this: http://javascript.info/tutorial/animation


    RMMV has an internal animation system. You could plug into that, create a specific animation, and use a script call event on the object you want to be thrown.


    If you want to learn, your best bet is to find the resources yourself. I'm sorry, but the scope of what you're asking for is far too much to expect that someone would take the time to teach you.
     
    #12
  13. ICF-Soft

    ICF-Soft Veteran Veteran

    Messages:
    209
    Likes Received:
    99
    First Language:
    Spanish
    If there is a chance of getting a solution I want to ask how may I write this function to work inside map:


    proyectile(initpoint, finalpoint, frames)


    With this I think I'll be able to derive all what I need.
     
    #13
  14. geovanie

    geovanie Villager Member

    Messages:
    5
    Likes Received:
    3
    First Language:
    English
    Primarily Uses:
    RMMV
    Unfortunately, I don't think it's quite so easy as that. For an example of animation, look at the title screen. There's a fade-in effect. That should help you figure out how to decipher RMMV's animation system, then co-opt it using the information in the link I sent you.
     
    #14

Share This Page