• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] A smooth arrow key base jump?

Status
Not open for further replies.
Level 7
Joined
Oct 8, 2008
Messages
200
How can I make a jump jass trigger that just go up and down unless like am pressing an arrow key. So Like if I press foward it jump foward
 
Level 7
Joined
Oct 8, 2008
Messages
200
Ok the only problem is I don't know how to make my unit go up and down in jass the rest I can figure out
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
For it to be smooth you need to makeit update atleast every second frame, 60 times a second should be your max update value.

For the jump part you use maths, a simple quadratic or something should do the trick. Eithor that or you use a custom physics system which would take slightly longer.

You then just need to detect the right arrow keys and preform the jump in the correct direction.

A timer is advised to do the perodic updating of the units position.
 
Level 7
Joined
Oct 8, 2008
Messages
200
Ok thank you also what the difference between vJass and Jass? I hear vJass is better so am thinking of switching to it soon
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
vJass allows you to emulate OOP programming. It's just a much neater way of coding, and neat codes are always awesome.

About not knowing how to change height, there's the function SetUnitFlyHeight.

As to what DSG said - 60 fps? the human eye can hardly see any difference between 16 FPS, so why for the love of the gods would you want 60 FPS?
Normally people use something between 20 and 35 FPS, or so.

As to moving according to the arrows - if you can jump and THEN also click on them to move (which isn't technically possible in this world), like all the old games (actually most of the new games too), then you should consider the Z axis and the X and Y axis as different units.
The Z should just change upon jumping, and the X/Y should move according to a Speed variable, which will be determined by the keys currently selected.

If you can only jump towards a direction if a key was pressed before, then you'll indeed need to check for keys upon jumping.

Also just a tip - if you want this to be MUI, it means you'll either have to move locals from function to function, which as always is a nightmare, or make arrays (8129 instances is enough, isn't it? :p) for each attribute, for example: an array for the units, an array for the speeds, an array for maximum height, etc.
This is where vJass gives you a easy way to code this in a neater (not necessarily more efficient, more likely the other way around, but who cares about the 0.00001 seconds you just missed?) with structs.
You can define your own types which hold other types.
I really suggest to get into vJass for this kind of codes.
 
Status
Not open for further replies.
Top