![]() |
Car Movements Help
I am working on a "Car" for Graal Ghetto and so far all I have is the movement.
For my example I have added a block image to show the "Car". Although the movement is working perfectly the acceleration isn't. The problem is when accelerating if you turn it stops accelerating. Here is what I have so far. I am entrusting that the Graal community will NOT steal this, as I have spent about an hour and a half just getting this much. 2330 Characters long and 87 lines. Thanks. PHP Code:
Removed the players movement seeming as it isn't necessary. Also to make it harder for people to steal this script and actually use it. |
PHP Code:
PHP Code:
PHP Code:
And stop worrying about people stealing your scripts. It's not as big of a deal as you might think. |
Thanks, I wasn't aware of the if(keydown(0)){
I have always wondered if there was something like that. In flash it's if(key.is.down(KEY.UP)){ And regarding quotes, Im just use to using them. Il remember in future you dont need them. Would it be possible to have in a gani the showimg but have it something like this. PHP Code:
|
On an related note, is there any way to show an image and change its rotation serverside without using a gani?
Using a gani if you lag it looks retarded. |
use a weapon and a showimg statement with an index less the 200, while setting the player gani to only show the head. Should work relatively well :)
and I did something like this a while back so I'll show a player direction formula with you that I nutted out while falling asleep in my maths lecture: (int((angle+(pi*.25))/(pi*.5))+3)%4 That should work logic wise, no guarantees it'll definately work though |
Thanks, but I can't seem to get the rotation of the image to show serverside without putting it in a gani.
And putting it in a gani makes it laggy. As for your equation thanks, it helps. I never paid attention during any math lectures.. As I can understand it, its something like this. Integer of the angle plus 3.14 times by 0.25 divided by 3.14 times by 0.5 + 3 % 4. Im unsure of the %4 though. I mean it's going to be percentage 4, but how does that make sense? Maybe it's just the GS2 syntax of how that's set out that I don't understand.. |
Quote:
|
Thanks..
But as I have said, is there any way of getting the images rotation to either show as a gani (SMOOTHLY) even when lagging, or make the findimg(index).rotation = this.angle serverside? I have tried it in a gani but with the slightest lag it makes it jumpy. |
Quote:
|
I was doing something like this.
In the main script every 0.05 second on a timeout I was making player.attr[4] the car image and player.attr[5] the angle. then in the gani every 0.05 seconds I was updating the images angle. something like this. PHP Code:
|
This might help you
http://forums.graalonline.com/forums...highlight=gani |
Quote:
PHP Code:
|
What kind of lag are you seeing with your solution? It looks like it ought to work fine as long as you're putting it in a player attribute, not using it as the player's GANI.
|
When you turn left the angle is in the minus and it just gets jumpy and goes from say 36° to around 46° and it looks really bad.
I think I may have found a fix. I have made the start angle extremely high, in the millions so that the player would have to turn left about 20,000 times to undo it. |
Quote:
If it's the latter, then there's not much you can do about it besides inter/extrapolation which is overkill at this point. Post the code of how you're setting the GANI in the car script. |
All times are GMT +2. The time now is 12:33 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.