Omnimaga: The Coders Of Tomorrow
Welcome, Guest. Please login or register.
 
Omnimaga: The Coders Of Tomorrow
20 May, 2013, 16:52:59 *
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.

Pages: 1 ... 83 84 [85] 86 87 ... 110   Go Down
  Print  
Author Topic: Axe Q&A -  (Read 59392 times) Bookmark and Share
0 Members and 1 Guest are viewing this topic.
epic7
Chopin!
LV11 Super Veteran (Next: 3000)
***********
Offline Offline

Gender: Male
Last Login: Today at 04:26:36
Date Registered: 22 October, 2011, 01:45:43
Location: Northeast US
Posts: 2162


Total Post Ratings: +118

View Profile
« Reply #1260 on: 20 December, 2011, 04:56:16 »
0

I have a question: why doesn't this code work? (It compiles, but it glitches on me)
0→{S}→{S+5}→{S+15}
and S is the pointer to appvar.
(I just had this happen to me too and I spent a couple of hours before getting Runer's help and facepalming.)

Because of the way Axe optimizes, number→{pointer} returns the pointer instead of the number.  The code equivalent to what you are doing is actually this:
:0→{S} :S→{S+5} :S+5→{S+15}
Oh I think I've been doing that shocked
I've noticed a few bugs in my game so I'll check for those Tongue

For that
and 0->
Is that supposed to be more optimized than
0->
« Last Edit: 20 December, 2011, 05:01:25 by epic7 » Logged



Current Projects:
TitleLanguageProgressStatus
DrillMiner    C (ndless)   35%         Active
?     C (ndless)   0%        Unconfirmed

Spoiler for Programming languages I currently know:
Java (Learning in AP Comp Sci)
C (Specifically Ndless)
Unity JavaScript
LabView (For FIRST robotics)
z80 ASM (Just a little bit Tongue)
squidgetx
Food.
Coder Of Tomorrow
LV10 31337 u53r (Next: 2000)
*
Offline Offline

Gender: Male
Last Login: 28 April, 2013, 23:50:38
Date Registered: 30 May, 2010, 19:54:18
Location: eating somewhere
Posts: 1829


Topic starter
Total Post Ratings: +476

View Profile
« Reply #1261 on: 20 December, 2011, 05:43:25 »
0

Only if you are storing to a one-byte value.

I need to update my guide...lool
Logged

Read my webcomic! | My SoundCloud
Projects:

Check out the demo now!- Current progress: battle engine and stuff
Proud author of: Cuberunner | SpaceDash | The Psyche | XXEdit | AxeSynth | StickNinja | Gravity Guy | Embers:Phoenix | Zombie Gun
Axe: Need help optimizing?
User of Axe | zStart | TokenIDE | CalcGS | MirageOS
Deep Thought
So much to do, so much time, so little motivation
Administrator
LV13 Extreme Addict (Next: 9001)
*
Offline Offline

Gender: Male
Last Login: Yesterday at 19:18:47
Date Registered: 19 May, 2009, 08:00:00
Location: The Universe
Posts: 7813


Total Post Ratings: +706

View Profile WWW
« Reply #1262 on: 20 December, 2011, 06:05:31 »
0

For that
and 0->
Is that supposed to be more optimized than
0->
Explained right before you posted, but you probably didn't notice because it was the last post on the page. It's one byte smaller and three cycles faster (but it works only if you're doing something with one byte, as squidgetx said, such as for sin(), xor , or →{}).

You probably wouldn't notice if you just used 0, though Big smile
« Last Edit: 20 December, 2011, 06:06:17 by Deep Thought » Logged




epic7
Chopin!
LV11 Super Veteran (Next: 3000)
***********
Offline Offline

Gender: Male
Last Login: Today at 04:26:36
Date Registered: 22 October, 2011, 01:45:43
Location: Northeast US
Posts: 2162


Total Post Ratings: +118

View Profile
« Reply #1263 on: 20 December, 2011, 06:10:42 »
0

Only if you are storing to a one-byte value.

I need to update my guide...lool
Please do. Everything I know on optimizing is from that Tongue
Logged



Current Projects:
TitleLanguageProgressStatus
DrillMiner    C (ndless)   35%         Active
?     C (ndless)   0%        Unconfirmed

Spoiler for Programming languages I currently know:
Java (Learning in AP Comp Sci)
C (Specifically Ndless)
Unity JavaScript
LabView (For FIRST robotics)
z80 ASM (Just a little bit Tongue)
epic7
Chopin!
LV11 Super Veteran (Next: 3000)
***********
Offline Offline

Gender: Male
Last Login: Today at 04:26:36
Date Registered: 22 October, 2011, 01:45:43
Location: Northeast US
Posts: 2162


Total Post Ratings: +118

View Profile
« Reply #1264 on: 21 December, 2011, 22:53:07 »
0

Can Z-Test be used to go to subroutines?

Like doing
1->A
Z-Test(A,1
Disp "World" ;returns here after subroutine
Return
Lbl 1
Disp "Hello"
Return

And have it display Hello world?
Logged



Current Projects:
TitleLanguageProgressStatus
DrillMiner    C (ndless)   35%         Active
?     C (ndless)   0%        Unconfirmed

Spoiler for Programming languages I currently know:
Java (Learning in AP Comp Sci)
C (Specifically Ndless)
Unity JavaScript
LabView (For FIRST robotics)
z80 ASM (Just a little bit Tongue)
calc84maniac
Epic z80 roflpwner
Coder Of Tomorrow
LV11 Super Veteran (Next: 3000)
*
Offline Offline

Gender: Male
Last Login: 14 May, 2013, 10:02:35
Date Registered: 28 August, 2008, 05:09:05
Location: Right behind you.
Posts: 2735


Total Post Ratings: +373

View Profile
« Reply #1265 on: 22 December, 2011, 02:25:59 »
0

Try this:

1
2
3
4
5
6
7
8
9
10
0→A
DO(A)
Disp "World"
Return
Lbl DO
Z-Test(r1,1)
Return
Lbl 1
Disp "Hello"
Return
Logged

"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman
Darl181
Vy'o'us pleorsdtu tlh'e gjaemue.
Coder Of Tomorrow
LV12 Extreme Poster (Next: 5000)
*
Offline Offline

Gender: Male
Last Login: Today at 12:43:35
Date Registered: 10 June, 2010, 00:32:08
Location: {I*9+L₁+1},{I*9+L₁+3}
Posts: 3272


Total Post Ratings: +267

View Profile WWW
« Reply #1266 on: 22 December, 2011, 06:04:36 »
0

Ok I'm trying to figure out how to do angles.
What I'm thinking of is if some value is, say, 64 (the 256-degree equivalent of 90 degrees), it sets the x-velocity to the max and y-velocity to 0.  If that value is 128 it should set the y-vel to the max, x-vel zero, etc.

How would I go about doing this?

EDIT: answered on IRC.
.A is angle, 256 degrees
.M is max velocity
cos(A)*2**M→(x-vel)

Then determine Y-velocity based on that.
« Last Edit: 22 December, 2011, 06:31:31 by Darl181 » Logged




 
Spoiler for Stuff:



OS 2.43  Boot 1.02  Hardware Rev. B

OS 1.04.32

OS 3.1.0.392  Boot1 3.0.99  Boot2 3.10.16
Spoiler for Misc:
Quote
You'll understand / It's not a shame / To be always / Losing the game / Burma-Shave
"Dynamic userbars!"
Omnimaga radio
Interactive Omnimaga radio
Our World of Text
Draw on websites
Then blow them up
In-browser flight simulator
Haxball: MMO soccer/air hockey game
  Draw with sand.  Yay?
The Game
You just lost the game
Zombo.com
light post color is #dfefff
dark post color is #cae4ff
quote box color is #6699ff
transparent color is...transparent 0.o
Spoiler for Forum search alternative (bookmarklet):
https://www.squarefree.com/bookmarklets/search.html
javascript:q=""+(window.getSelection?window.getSelection():document.getSelection?document.getSelection():document.selection.createRange().text);if(!q)q=prompt("No%20selected%20text;%20enter%20search%20term.").replace(/\s\+/g,"%252B");if(q!=null)location="http://www.google.com/search?q="+q.replace(/\s+/g,"+")+"+site:"+location.hostname;void(0);
Builderboy
Physics Guru
LV13 Extreme Addict (Next: 9001)
*************
Offline Offline

Gender: Male
Last Login: Today at 11:52:38
Date Registered: 20 April, 2009, 00:28:53
Location: Ravenholm
Posts: 5642


Total Post Ratings: +589

View Profile
« Reply #1267 on: 22 December, 2011, 06:33:16 »
0

Cos(angle) for the X velocity and Sin(angle) for the Y velocity?
Logged

Darl181
Vy'o'us pleorsdtu tlh'e gjaemue.
Coder Of Tomorrow
LV12 Extreme Poster (Next: 5000)
*
Offline Offline

Gender: Male
Last Login: Today at 12:43:35
Date Registered: 10 June, 2010, 00:32:08
Location: {I*9+L₁+1},{I*9+L₁+3}
Posts: 3272


Total Post Ratings: +267

View Profile WWW
« Reply #1268 on: 22 December, 2011, 06:35:06 »
0

Hm that makes sense actually..I was thinking it might be something really simple like this but didn't know what it would be Tongue
tho I prolly should have known after taking algebra II...idk :\
Logged




 
Spoiler for Stuff:



OS 2.43  Boot 1.02  Hardware Rev. B

OS 1.04.32

OS 3.1.0.392  Boot1 3.0.99  Boot2 3.10.16
Spoiler for Misc:
Quote
You'll understand / It's not a shame / To be always / Losing the game / Burma-Shave
"Dynamic userbars!"
Omnimaga radio
Interactive Omnimaga radio
Our World of Text
Draw on websites
Then blow them up
In-browser flight simulator
Haxball: MMO soccer/air hockey game
  Draw with sand.  Yay?
The Game
You just lost the game
Zombo.com
light post color is #dfefff
dark post color is #cae4ff
quote box color is #6699ff
transparent color is...transparent 0.o
Spoiler for Forum search alternative (bookmarklet):
https://www.squarefree.com/bookmarklets/search.html
javascript:q=""+(window.getSelection?window.getSelection():document.getSelection?document.getSelection():document.selection.createRange().text);if(!q)q=prompt("No%20selected%20text;%20enter%20search%20term.").replace(/\s\+/g,"%252B");if(q!=null)location="http://www.google.com/search?q="+q.replace(/\s+/g,"+")+"+site:"+location.hostname;void(0);
calc84maniac
Epic z80 roflpwner
Coder Of Tomorrow
LV11 Super Veteran (Next: 3000)
*
Offline Offline

Gender: Male
Last Login: 14 May, 2013, 10:02:35
Date Registered: 28 August, 2008, 05:09:05
Location: Right behind you.
Posts: 2735


Total Post Ratings: +373

View Profile
« Reply #1269 on: 22 December, 2011, 06:50:03 »
0

Rather than computing Y velocity based on X velocity, it might be better to just do sin(A)*2**M→(y-vel)
Logged

"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman
jacobly
LV4 Regular (Next: 200)
****
Offline Offline

Last Login: Today at 05:21:49
Date Registered: 09 October, 2011, 01:53:09
Posts: 199

Total Post Ratings: +149

View Profile
« Reply #1270 on: 22 December, 2011, 07:12:23 »
0

Here is an example program that might help:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
:.VELOCITY
:192→θ .begin facing up
:0.0→V .begin stationary
:47.0→X .begin in the middle
:31.0→Y
:Repeat getKey(15)
:getKey(4)-getKey(1)+V→V .press up/down to speed up/slow down
:getKey(3)-getKey(2)+θ→θ .press left/right to turn left/turn right
:cos(θ)*2**V+X^96.0→X .use V and θ to change position
:sin(θ)*2**V+Y^64.0→Y
:Pxl-On(X/256,Y/256)
:DispGraphClrDraw
:End
Logged
Yeong
Eternally Young Scarlet Moon
LV12 Extreme Poster (Next: 5000)
************
Offline Offline

Gender: Male
Last Login: Today at 01:44:48
Date Registered: 15 October, 2010, 04:29:49
Location: Arden, NC
Posts: 3694


Total Post Ratings: +260

View Profile
« Reply #1271 on: 30 December, 2011, 20:29:48 »
0

is there a way to shift the portion of the buffer? (Rectangular region will be fine.)
Logged

Project Redemption....

My project progresses:HERE
My Pastebin stuffs:HERE
Check your rate: HERE
My Animations: HERE
Spoiler for Images :D:

ノ◕ヮ◕)ノ:・゚ PENGUIN WAVE!!:„ø¤º°¨ ¨°º¤KEEP THE PENGUIN GOING ¸„ø¤º°¨ ¨°º¤øº LETS GO PENGUIN !¤¤º°¨¨°º¤øº¤ø„¸¸ø¤º°¨„ ø¤º°¨¨°º
ztrumpet
The Rarely Active One
LV13 Extreme Addict (Next: 9001)
*************
Offline Offline

Gender: Male
Last Login: 23 April, 2013, 16:09:52
Date Registered: 08 November, 2009, 21:10:12
Location: Michigan
Posts: 5687


Total Post Ratings: +360

View Profile
« Reply #1272 on: 30 December, 2011, 21:50:54 »
0

Are you talking at an arbitrary spot, or can it be in multiples of 8 pixels in the X direction?  It's quite easy if the X can be in multiples of 8, but a little more difficult if you need to mask off parts of bits.
Logged

MGOS
LV5 Advanced (Next: 300)
*****
Online Online

Gender: Male
Last Login: Today at 16:30:11
Date Registered: 29 July, 2011, 16:54:53
Location: Germany
Posts: 295


Total Post Ratings: +73

View Profile
« Reply #1273 on: 31 December, 2011, 15:25:09 »
0

Another question about number input:

I need a function in my program that checks if a number key from 1 - 8 is pressed. It should return the a value between 1 and 8, or 0 if none of them is pressed. I already looked at the number input routine, but it isn't that what I need.
Would you recommend a LUT, a mathematical way or only some Ifs and Elses?
Logged

Click those to see more information Smiley
Current   
Projects: 
ztrumpet
The Rarely Active One
LV13 Extreme Addict (Next: 9001)
*************
Offline Offline

Gender: Male
Last Login: 23 April, 2013, 16:09:52
Date Registered: 08 November, 2009, 21:10:12
Location: Michigan
Posts: 5687


Total Post Ratings: +360

View Profile
« Reply #1274 on: 31 December, 2011, 18:20:48 »
+1

I recommend using inData.  Yesterday I wrote some code to do the exact thing you talk about, only with the numbers 0 through 9, and it looks like this:

While 1
EndIf inData(getKey,Data(33,34,26,18,35,27,19,36,28,20,0))->r1


This gives you the number of the key pressed plus one, stored in r1.  If my condensed code doesn't make sense to you, here's an uncompressed version:

Data(33,34,26,18,35,27,19,36,28,20,0)->GDB0
While 1
getKey->K
inData(K,GDB0)->r1
EndIf r1


You could easily modify it to suit your needs, and while you do it I hope you figure out how it works.  InData is a very useful and powerful command, though it is a bit advanced. If you need more help with it, check out this post: http://www.omnimaga.org/index.php?topic=1532.msg60704#msg60704

Edit:  In response to your question, I am using a LUT, but accessing it through InData for some great space savings (assuming you use InData more than once or twice in your program).
« Last Edit: 31 December, 2011, 21:26:32 by ztrumpet » Logged

Pages: 1 ... 83 84 [85] 86 87 ... 110   Go Up
  Print  
 
Jump to:  

Powered by EzPortal
Powered by MySQL Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Powered by PHP
Page created in 0.408 seconds with 31 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.