![]() |
Non-linear random movement
Hey guys, does anyone know how to make NPCs move in a curved form, but randomly throughout the level? The onwall would also be helpful for that too... If anyone can help, thanks!
|
so you wat an NPC that moves around a level in a wavey form and it also has to have onwall
what exactly do you need this for? |
just do random angle and do sine + cosine .. not hard
|
Bosses and baddies, Alex...
LiquidIce, could you show me a bit more? I haven't learned geometry yet, so I don't even really know how any of that works... |
Damnit Kai! You say a lot of stuff that almost never helps... Why not trying to teach something about it?
|
Well... I'm pretty sure you don't wanna waste all that time (if you are, I'll willing to learn), so could you teach me a little something that might help, or point out a site to teach?
|
Quote:
I would do an array of next movements.. like I would randomize an angle then I would check prolly 5 steps more with that same angle (or angle -1 for each step or whatever) then I would do onwall check to make everything is fine and walk it thru the array. so you would do curves.. |
yea mee too
1 Attachment(s)
i saw like this.blah=cos blah blah
this.blah=sin blahblahblahi need help too what cos and sin is :megaeek: :megaeek: :megaeek: :grrr: :grrr: :grrr: oh yeah heres a pic (Really good) |
Bah, I know that Vinvect... I just don't understand what LiquidIce is talking about.
|
Hmm it shouldn't be that hard, i could help you cyanide if you do the onwall stuff... Or more like maybe I could help you. :p
|
I know that Kai... But can't you point out where I could learn, or at least start off? Or a script you've made that includes this that I can study from?
Damn you British and you big words... incredulous (adj) - skeptical |
It's not really simple math
NPC Code: 3.14 = pi It's dy = -sin(radangle) because when the angle is pi/2 (90 degrees) then it should move up, so sin(90) = 1 needs to move the npc up which means y needs to be decreased |
Thank you so much Stefan! =D
And Kai, never say that I can't do something... Then I'm forced to defy it :(. |
Hehe, I learned algebra 6 years before I should have... Calculus shouldn't be too hard.
Hmmm... Stefan's script wasn't exactly what I was hoping for (but I have to say it's the shortest version of that script I've ever seen). I'm looking for something similar to the movement system of the spade boss Flagr made for Antago (not the one online, the one that was on Antago Press), as I recall from ages ago.... Anyone got that? It might be in Antago's hard drive... |
just get random angles then use stefans script but array every single movement . so your creature walks in an actual curve not like diagonally but not really a curve.. and of course dont forget onwall^_^
|
Quote:
|
Quote:
|
Quote:
you get a base angle for 5 steps like for example its 1.07 then you random out value between -.2,.2 so if it gets a 0 then it just walks diagonally .. if u get a -.2 then it will walk a up curve or whatever or a positive a down curve. would work fine ;) |
here i didnt actually test this i just put on graal and clicked style and test to debug it but its just a base of what I was saying (prolly buggy) and i didnt do it using showcharacter either..
NPC Code: |
Wow, that was really helpful for other things, but still not quite what I need =(. Someone gimme Antago's hard drive, please...
|
If memory serves, all the nonlinear motion scripts he had came from me anyway, particularly the bird...
The trick is to modify this.xspeed and this.yspeed instead of x and y directly. So if(dir=0) this.yspeed-=random(0.5,1); //try to go up - if you're going down, slow down some //etc while(abs(this.yspeed)>1) this.yspeed*=0.9; //maximum speed=1 tile per call //etc this.testy=y+this.yspeed; //all the usual onwall: if it hits the wall, this.testy=y; this.testx=x; y=this.testy; You can get it from there easy. If you can't, give up, you're scripting out of your league. |
Quote:
if thats what u ment ;\ |
But that didn't look like a curve, LiquidIce.
|
| All times are GMT +2. The time now is 12:32 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.