Odd Scripting error.
I am making a kinda version of snake, but instead of growing longer I have the object move faster , so this is where the problem comes in, on the timeout i have it move the gui control based on the direction, but if the direction is going ether right or down it doesn't work , and I really cant find out why. Thanks in advance.
PHP Code:
|
Remember, Graal's directions use the values, 0, 1, 2, 3 and has built-in functions to make tasks working with them easy.
A good way to get the direction to move would have to be adding key checking in your Timeout loop like so. PHP Code:
PHP Code:
Also another good habit to get into is only loop when you need to! PHP Code:
|
Well, after your post i rescripted the timeout , which ur way also made it much more effiecient thank you, but it still does not move right or down ;/
PHP Code:
|
I just tested my examples and they worked fine, also remember you're working with pixels not Graal x, y, coordinates. So try increasing your speed above 1.
Try.. this.speed = this.lvl * 1; That assumes that you're setting this.lvl to 1 though. Also just learned that you should use keydownglobal() function instead of keydown() Here is my example.. PHP Code:
|
Ah thanks for all the help fowlplay, I found my script error, i was using this.level which is obviously a reserved variable so for my this.speed I was getting 0 so I was not moving those 2 directions :P, once again thanks alot man!.
|
All times are GMT +2. The time now is 07:21 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.