![]() |
Gravity....
Hello, I am making a gravity room for my guild house and I was wondering why my script makes people go through objects.... basically I have it make the playery subtract one every .05 seconds, and if the up arrow is pushed, then they go up, but for some reason it makes them go through tiles... I remember doing this with an older version of graal and it worked fine. Did stefan/unixmad change that in a later release?
And I would like to know if anyone can help me this is my code.... // NPC made by Stipo Swift -Leader- (Turtles) if (created) { falling = true; } while (falling==true) { playery = playery + 1; sleep .05; if (keydown(A)) { playery = playery - 2; if (playery > 60) { playery = playery - 2; } } } any suggestions? :confused: |
erm, keydown(A)?
Also you need to do onwall checks to stop it from going on walls. Please look into another way of doing this. |
well thats why I am here, to find out other ways of doing it, I'm not a professional :P
|
Re: Gravity....
Quote:
and keydown needs a number argument, its in the commands.rtf (the list on the left in the offline script editor) |
ok, thank you, like I said i'm new to this.
and I was wondering if you could get an NPC to say a variable... like the playerx and playery variables... I've been looking through the list and so far I have nothing.... |
use #v(variablehere) in the message, those parseing things are at the end, their not incredibly straight forward so you just have to experiment with them more to figure them out
|
ok, thanks... one more question for tonight, will
if (onwall(playerx,playery)) work for this situation? |
you need to detect if the player has hit a wall or come to an object that is set to block the player using onwall command, also use if(keydown2(keycode(a),false)) or if(keydown(5)) if ya wanna be nubish about it :)
|
the position (playerx,playery) is at the top lefthand corner of the player, use playerx+1.5,playery+2 it's not exact (playery+1.96875 is right) but there is hardly a difference so it doesn't matter
onwall is a function ack, I just noticed, don't use a while loop for that, use a timeout |
timeout would also fix that delay you've got with the sleep. Also, get into the habbit of using this:
NPC Code: etc, it looks alot neater :] |
I would like to see the gravity script from g2k1 and how it was done it worked rather smoothly than most I have seen :).
I made one but its a little buggy going up |
Quote:
|
1 Attachment(s)
Quote:
try it out before jumping to conclusions next time, say something in this level, one of the npcs calculates the middle of the player |
Quote:
It's simply not possible to get more accurate than a pixel. If you use something like that in any onwall check or whatever, Graal is going to round it some way or another. |
Quote:
It's not like i'm proposing the use of such numbers, I did say to use 2. Granted I didn't notice that the number was in the middle of a pixel untill you said something, but it's not like I'm wrong. |
Quote:
Quote:
|
Quote:
okay... i'm looking that up in the npc scripting help that comes with graal.... so far i'm understanding it. |
Quote:
|
Quote:
Quote:
|
Goodbye thread.... :(
|
Quote:
|
Dude, don't post in threads that are more than a couple of weeks old.
|
I just felt for making a gravity script now...
EDIT: Maybe I should rather call it side-viewed graal? |
| All times are GMT +2. The time now is 02:37 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.