directional velocity minus ???

Non-platform specific questions.

directional velocity minus ???

Postby sportmaster » Tue Jul 13, 2010 2:56 pm

why this code [key down, repeat -> script editor] is working with x velocity and y velocity but with directional velocity it doesn't ?
Code: Select all
...velocity -=1;
User avatar
sportmaster
 
Posts: 32
Joined: Thu Jun 25, 2009 8:29 pm
Score: 0 Give a positive score

Re: directional velocity minus ???

Postby jimmynewguy » Tue Jul 13, 2010 3:13 pm

Code: Select all
directional_velocity-=1;

that should definately work, if it isnt something has to be wrong. Make sure the repeat is on i guess. Dont know what to tell you really if that doesnt work.
Working on a probably too ambitious project! Wild-west-adventure-RPG-shooter-thing.
User avatar
jimmynewguy
 
Posts: 1137
Joined: Sat Mar 31, 2007 6:27 pm
Score: 89 Give a positive score

Re: directional velocity minus ???

Postby lcl » Tue Jul 13, 2010 3:50 pm

Make sure you have some value in angle. Angle and directional_velocity work together. :D
User avatar
lcl
 
Posts: 2339
Joined: Thu Mar 25, 2010 5:55 pm
Location: Finland
Score: 276 Give a positive score

Re: directional velocity minus ???

Postby sportmaster » Tue Jul 13, 2010 11:53 pm

dont know whats going on :( please take a look at this. Press down button and see the problem. The angle is 90, repeat is enabled and code is : directional_velocity -=1; The movement isnt smooth and its to slow.
Attachments
Test.rar
just one Velocity test pacman.
(1.25 KiB) Downloaded 45 times
User avatar
sportmaster
 
Posts: 32
Joined: Thu Jun 25, 2009 8:29 pm
Score: 0 Give a positive score

Re: directional velocity minus ???

Postby DST » Wed Jul 14, 2010 12:58 am

Don't use the - sign for the directional_velocity, it's supposed to be positive direction. When you use -1 dv + 90 angle, you're actually moving 270 degrees instead of 90.

Try:

directional_velocity=1;
angle=270;

on the keydown>down.

Directional velocity is a constant, you wouldn't want to add to it, just set it. Never use negative values on it, instead, just change your angle.
It's easier to be clever than it is to be kind.
http://www.lostsynapse.com
http://www.dstgames.com
User avatar
DST
 
Posts: 1117
Joined: Sun Apr 15, 2007 5:36 pm
Location: 20 minutes into the future
Score: 151 Give a positive score

Re: directional velocity minus ???

Postby Hblade » Wed Jul 14, 2010 1:07 am

DST

Heres a whopper for ya...

How would I go about calculating the angle AND velocity speed (Directional_velocity?) of the impact when a collision is made on something with a slanted surface. In other words, I want to say if I collide into something with a 34 degree angle, that it would act as a physical response but I dont want to use physical response, because when it comes to particles or many actors you know that physical response lags xD
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score

Re: directional velocity minus ???

Postby DilloDude » Wed Jul 14, 2010 6:42 am

You'll need a way of knowing the angle of the surface. See my post here.
Then you'll need to measure the difference between these angles, using getangle.
Then you can find the correct angle to bounce off.
Image
User avatar
DilloDude
 
Posts: 866
Joined: Tue Jan 24, 2006 9:51 am
Location: Nyerellion
Score: 58 Give a positive score

Re: directional velocity minus ???

Postby Bee-Ant » Wed Jul 14, 2010 8:51 am

Hblade wrote:I want to say if I collide into something with a 34 degree angle, that it would act as a physical response but I dont want to use physical response, because when it comes to particles or many actors you know that physical response lags xD

Hmmm...if you want to make physical response without using Physical Response, try this :

Particle->Collision->Platform :
Code: Select all
angle+=180;
directional_velocity-=directional_velocity;

But I can't guarantee the accuracy. Since it just uses very simple code...
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score

Re: directional velocity minus ???

Postby Hblade » Wed Jul 14, 2010 9:58 am

Thanks, both of you :D
Subscribe to my YouTube? - Yes| No
User avatar
Hblade
 
Posts: 4455
Joined: Fri Dec 08, 2006 11:14 pm
Score: 181 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest

cron