The Daily Click ::. Forums ::. Klik Coding Help ::. mouse controlled object, with obstacles
 

Post Reply  Post Oekaki 
 

Posted By Message

eX Com



Registered
  15/08/2002
Points
  352
8th July, 2004 at 23:22:31 -

Okay, I have this mouse controlled object and I don't want it to be able to go through these obstacles (active objects) so I tried setting the object to Bouncy Ball movement and using Always set object to XMouse blah blah blah, but it didn't work. SO then I tried Fastloop and it almost worked except if you move the mouse fast enough, the object can go right through the obstacle. Is this hopeless or is there some way to do this..
thanks

 
The chickens are coming...

ShadowCaster

Possibly Insane

Registered
  02/01/2002
Points
  2203
9th July, 2004 at 00:42:29 -

You should be able to do it simply with the "Mouse" movement.

- Right-click on the active object you want the user to control

- Select Properties -> New Movement

- Click "Mouse Controlled" from the list

- Right-click on an object you want the player controlled object to collide with

- Select Properties -> Obstacle

- Under "Obstacle Type" select "Obstacle" and click OK

- Open the Event Editor

- Create a new event under the player controlled active object and select Collisions -> Backdrop

- Under the active object in the Actions section, right-click and select Movement -> Stop

And that should be it.

Mike

 
"Now I guess we're... 'Path-E-Tech Management'" -Dilbert

eX Com



Registered
  15/08/2002
Points
  352
9th July, 2004 at 11:48:55 -

oookay that worked, thanks.. but what about an arrow block, where you can only go through it in one direction. How would I do that? You would need to find the direction of the mouse movement or something...
(im using tgf by the way )

Image Edited by the Author.

 
The chickens are coming...

eX Com



Registered
  15/08/2002
Points
  352
9th July, 2004 at 16:43:40 -

anyone anyone at all lol

 
The chickens are coming...

Klikmaster

Master of all things Klik

Registered
  08/07/2002
Points
  2599

Has Donated, Thank You!You've Been Circy'd!VIP MemberPS3 Owner
9th July, 2004 at 17:05:54 -

This should make it possible to only go right...
Player is facing left + Active object is overlapping active object 2
- Movement stop

and the opposite for left

 
n/a

Teapot

Does he even go here

Registered
  02/10/2003
Points
  2631

VIP Member
9th July, 2004 at 18:48:55 -

Klikmaster: Don't you mean the opposite for right.

 
n/a

eX Com



Registered
  15/08/2002
Points
  352
9th July, 2004 at 19:18:44 -

nah that doesn't work either.. I can send you the file if you give me your email addy.. sorry I dont have a web site other than geoshitties to upload to.

[edit] i uploaded it to geocities anyway http://www.geocities.com/bookofsimpson/mouse.zip


Image Edited by the Author.

 
The chickens are coming...

eX Com



Registered
  15/08/2002
Points
  352
13th July, 2004 at 22:03:21 -

can't anyone help me lol

 
The chickens are coming...

DistantJ [FZ Games]



Registered
  02/08/2004
Points
  855
2nd August, 2004 at 20:08:33 -

I created my own mouse controlled movement engine a while ago to deal with this. Rather than using mouse controlled movement or XMouse and YMouse I managed to detect when the mouse was moving using counters.

At the start of the frame, the counter "X" is set to XMouse and the counter "Y" is set to YMouse. Then we have an equation. If XMouse is greater than counter X, then set any value you like, or any flag you like, just something to confirm that it's moving. Then do the same with YMouse and counter Y, and another value or flag. Do it again in reverse, for if it's less than the counter, and then you have detected the mouse moving in all possible directions.

Then you can pick up on the value or flag you set, and make your character move in 8 directions according to that. Either by using X/Y co-ordinates and markers to detect obstacles, or by using a bouncing ball object and altering it's direction and speed.

 
http://www.fzgames.com
   

Post Reply



 



Advertisement

Worth A Click