Omnimaga: The Coders Of Tomorrow
Welcome, Guest. Please login or register.
 
Omnimaga: The Coders Of Tomorrow
18 June, 2013, 10:22:17 *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
  home news downloads projects tutorials misc forums rules new posts irc about Login Register  
+-OmnomIRC

You must Register, be logged in and have at least 40 posts to use this shout-box! If it still doesn't show up afterward, it might be that OmnomIRC is disabled for your group or under maintenance.

Note: You can also use an IRC client like mIRC, X-Chat or Mibbit to connect to an EFnet server and #omnimaga.

  Show Contributions
Pages: [1]
1  Calculator Community / Axe Language / Scaling Vectors Help on: 05 June, 2012, 03:40:29
OK, so I have a golf-ish game where there is a ball that moves around the screen with separate x and y velocities which vary based on an angle chosen before the ball is hit. This all works perfectly fine, the ball bounces off the walls, etc. But when I try to apply friction to the ball's movement, I encounter some issues.

The process I am using to scale down my velocity vector while maintaining the same angle of motion is as follows:
   1. Find the magnitude of the vector
   2. Normalize the vector
   3. Decrease the value of the magnitude by a friction constant
   4. Multiply x and y velocity components by the new magnitude
My code looks like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
.PUTTPUTT
P*16**cos(θ)->V             //P represents power, used to determine how fast the ball will move
P*16**sin(θ)->W             //V is the X-velocity; W is the Y-velocity
Repeat getKey(15)
 Pt-On(X+V->X/256, Y+W->Y/256, Pic0)     //X and Y are the position components
 127*W//sin(tan-1(V,W))->M               //M is the magnitude of the velocity vector
 M-F*W//M->W                //F is the friction constant. I multiply the new magnitude by each component before dividing by the current magnitude
 M-F*V//M->V                //because W//M would give a value of 0
 If X/256>90
  -V->V
 End
 If Y/256>59
  -W->W
 End
 DispGraphClrDraw
End

Depending on P and θ, the code may or may not work, and I can't figure out why; the ball does seemingly random stuff, often not even going in the right direction. Huh?
Also, I don't know if this is relevant, but when I debugged the magnitude, it changed whenever the ball bounced off the left or right of the screen, which I don't think should be happening.
Can anybody help me fix this?
2  Calculator Community / Axe Language / Using tokens and strings together on: 20 April, 2012, 09:07:40
I'm attempting to access arbitrary OS vars from the calculator, and subsequently delete them. The code works with programs, groups, appvars, and letters, but whenever I try to access the vars represented by tokens, it does not work properly. Basically, I copy the randomly selected var name over into another string so that I can delete it, but the string doesn't seem to recognize the tokens following the first one. Here is my code (simplified):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
.DELSUB2
Fix 5
"var "->Str3
"ABCDEFGHIJKLMNOPQRSTUVWXYZØ"->Str5
"L1L2L3L4L5L6"->Str6
"  "->Str8
sub(LSD)
Return

Lbl LSD                             //This will only ever delete L1. If the randomly selected number is not 0, then nothing will happen
Copy(rand^6*2+Str6,Str8,2)
DelVar Str8
Return

Lbl ABC                             //This works
Copy(rand^27+Str5,Str3+1,1)
DelVar Str3

Is there a way to get around this lack of string support for tokens? Like, can these variables be accessed via hex code or something? Thank you!
Pages: [1]
Powered by EzPortal
Powered by MySQL Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Powered by PHP
Page created in 0.645 seconds with 28 queries.
Skin by DJ Omnimaga edited from SMF default theme with the help of tr1p1ea.
All programs, games and songs avaliable on this website are property of their respective owners.
Best viewed in Opera, Firefox, Chrome and Safari with a resolution of 1024x768 or above.