Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - rofurumao

Pages: 1
1
If you follow the system I show in Tutorial 4 (http://www.kongregate.com/games/Abigayl/stencyl-tutorial-4-mouse-based-shooting) for doing mouse-based shooting, you can send the actor in the direction of the mouse (with some minor modifications to the code). If you want the actor to STOP at the location the mouse was, store the location of the mouse in the actor's coding and set it to stop once it reaches the mouse's old location (might have to use a small region around the mouse-click's area since the actor might not actually hit the exact point).

If you want to, you can also modify the coding in Tutorial 4 to be the "slide" tween, but again add a check at the end (this time a "do after") to make sure the ending is the correct position.

Thanks for the help!

Yes, I followed that part of your tutorial before and helped during my initial experiments--the problem was me modifying it.  For some reason the character moved , but not towards the Mouse location.

Code: [Select]
always
if mouse is down
push self gradually towards x : x of mouse press, y : y of mouse press at 30 force

The 30 force is a placeholder. It keeps moving towards the lower right corner of the screen, not the mouse position. It worked if I just set its position though.

EDIT: Nevermind, it worked! My mistake is using "BY" instead of "TO".

2
Hi everyone :) I want to make a simple behavior for a point and click adventure game (think Monkey Island). Very basic question though--how do I move an actor to where I clicked the mouse? I know I have to get the MouseX and Y but I don't know how.

EDIT :

Wait--I got it. Now I need to find out how to MOVE the actor instead of setting its position. Using push didn't seem to work.

Pages: 1