Sign in to follow this  

Starting a point-and-click game, moving a char in X-axis (AS3)

This topic is 1951 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello evereybody !!

All the topics I started are some of the features I want to add to a game I'm working on, it will be a point-and-click game.

So I would like to know what you think about some things.

1) What do you think? Is it good to have the click and the use of the keyboard to move the character? (in a game design level) So far, I want to implement only move the char with the click of the mouse.

2) I can manage to handle the development of the char with the keyboard, but how can I do it with the mouse, in the way that the char moves to the place I click, then stops?

Making some research, I found that I can set action to a char with flags, like: if 'D' is pressed, charMoveRight=true; if this is true: character.x ++; else charMoveRight = false.

Now for the mouse click, I believe that can be something very alike: if mouseClick, charMove=true; if this is true: the character has to move where the mouseX is (consider that the char will only move in X)

Am I in the right track?? I think it have to be something that tells the char the place where it has to go (left or right) and when this happens, active a flag like: charWalks: = true; else charWalks = false; What do you think??

Thanks for your guidance guys !!

Share this post


Link to post
Share on other sites
Depends on details of your control design.

But one distinct aspect is that with keyboard control you are basically checking every tick if a button is pressed and then moving the character or setting a flag for another part of the code to move the character/update the animation etc.

With the mouse control you suggest, you are clicking on a location and I'd assume that the goal is now to move to that location over a given amount of time.

Depending on the design of your animation/movement system, how you make that happen can differ.

Here is a great tutorial that I suggest you check out regarding vectors :

[url="http://tonypa.pri.ee/vectors/start.html"]http://tonypa.pri.ee/vectors/start.html[/url]

It's not just about movement and this specific topic, but I'd suggest learning this aspect to better understand what you need to do. Edited by prototypical

Share this post


Link to post
Share on other sites
Thanks once again prototypical for your response.

[quote name='prototypical' timestamp='1344378464' post='4967176']
With the mouse control you suggest, you are clicking on a location and I'd assume that the goal is now to move to that location over a given amount of time.
[/quote]

Indeed, in the game you will click a location and the character will walk in that direction (only on X-axis). Very close to the mechanics used in [url="http://www.youtube.com/watch?v=HO8IuwtH9VA"]Maniac Mansion[/url] game. What will do is play the "moveToRight" or "moveToLeft" animation when the player either clicks to a right or left position of the character. With this in mind, is there a way / method I can activate the motion of the character from A (initial position) to B (clicked position) and stop the animation and movement as soon as the char gets to B?

[quote name='prototypical' timestamp='1344378464' post='4967176']
Here is a great tutorial that I suggest you check out regarding vectors :

[url="http://tonypa.pri.ee...tors/start.html"]http://tonypa.pri.ee...tors/start.html[/url]
[/quote]

Thanks for the link, I will read it to better understand vectors and it's usage.

Really happy with your responses prototypical, let's keep in touch !! Edited by JETerán

Share this post


Link to post
Share on other sites

This topic is 1951 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this