how to stop draging ball on left mouse button relase ?

Game Editor comments and discussion.

Postby Just4Fun » Wed May 17, 2006 5:07 pm

Hi sali11:

Take what I say with a grain of salt, but I thought that I would try out GE to see if I could get your ball problem solved. Now, I may not under stand what you are actually trying to do, but here is my VERY simple solution:

Create Actor: 'ball'
-->Add Event: "Mouse Button Down"
-----> In "Mouse Button Down Event Dialog Box" set the following:
------------>Press Mouse Button Down "Left"
------------>Drag Drop Down Box: "Enable"

Next:
-->Add Another Event: "Mouse Button Down"
-----> In "Mouse Button Down Event Dialog Box" set the following:
------------>Press Mouse Button Down "Left"
------------>Drag Drop Down Box: "Disable"

What this does is allow you to Drag your ball when it is clicked on using the left mouse button. When you click again with the left mouse button, the ball is 'released'. I don't know if this will solve the problem, or if I have the problem defined correctly, but when I tested it, it worked as I stated above. Anyway, let us know how you are doing.... :D
I've learned that I still have a lot to learn.

** Makslane == Genious **
Just4Fun
 
Posts: 524
Joined: Tue Jul 01, 2003 5:19 am
Location: USA: Washington State; West Coast
Score: 6 Give a positive score

Postby sali11 » Wed May 17, 2006 10:01 pm

Hi there Just4Fun

Im trying to make a pool type game and at the moment I am working on the white ball.

One of the things you need the white ball to be able to do is move it into the desired position right, behind the white line b4 breaking. So in order to apply this I was trying to use the drag function. Thankfully with help from almost every one in this forum lol :oops: , I have finally got it to work, I ended up using makslane way of doing it and it worked. I have the latest version of GE, and applying drag wont work untill I Add an action to it as well. thats where I was getting confused because I ended up selecting 'Follow Mouse' and thats what caused all the palava. any way thats sorted now.

Another thing that I have applied to the ball already is the power gauge, I got help for this and am using a scripts for applying the required velocity on the ball then hitting the ball by pressing the space bar.

At the moment, whats happening is that because I have this code on that ball for the velocity, when I click on the ball for the very first time to move it, the code kicks in and makes the ball drift away from the mouse, after I click and drag on the ball a few more times, it works fine.

This is the code I am using for the velocity, its in the draw actor script of the ball

directional_velocity = directional_velocity * 0.98;

on the arrow up key I have this:

if (textNumber < 60)
{
textNumber +=1;
}

and arrow down I have this:

if (textNumber > 0)
{
textNumber -= 1;
}

and on the space bar I have this:

directional_velocity = Display.textNumber;
if (directional_velocity < 0)
{
directional_velocity = 0;
}

I have tried all sorts of things to stop the drifting off the mouse on the first click. It is a strange bug to have. If you have any ideas on how to fix this bug, im all ears. If you want a link to what I have so far so you can see it for your self I can provide it, however I like learning this way, applying the code and making the mistakes is helping me learn allot in GE. thanks for your advise

AND A BIG THANK YOU TO EVERY ONE WHO HAS TRIED TO HELP ME, YOU LOT ARE GREAT :D
sali11
 
Posts: 37
Joined: Sun Apr 30, 2006 6:51 pm
Location: LONDON
Score: 0 Give a positive score

Previous

Return to GE - General

Who is online

Users browsing this forum: No registered users and 1 guest