Author Topic: Your Projects - Post and Critique  (Read 102349 times)

0 Members and 2 Guests are viewing this topic.

Offline XVicarious

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 485
  • Rating: +45/-28
  • I F**king Love Twisty Puzzles
    • View Profile
    • XVicarious
Re: Your Projects - Post and Critique
« Reply #510 on: January 14, 2011, 06:50:33 pm »
Yeah. I remember reading about pointers in C++, but never really had the chance to use them. And fyi I edited my previous post here.

Offline Michael_Lee

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1019
  • Rating: +124/-9
    • View Profile
Re: Your Projects - Post and Critique
« Reply #511 on: January 14, 2011, 06:56:07 pm »
Collision checking?  Do you mean making sure enemies never intersect?

If we keep the amount of enemies fairly low (under a hundred, probably), then you could just take a brute force method - randomly generate two numbers for X and Y coordinates, check those numbers against every other enemy's coordinates, then if the absolute difference is 7 or less, then either attempt select another random slot, or add/subtract the appropriate amount of numbers to get the enemies not to intersect.

Edit: You probably meant bullets - in that case, just use the same checks you did with variables, only because all of your data is in what is effectively a list, do the checks in a for loop.
« Last Edit: January 14, 2011, 07:01:13 pm by Michael_Lee »
My website: Currently boring.

Projects:
Axe Interpreter
   > Core: Done
   > Memory: Need write code to add constants.
   > Graphics: Rewritten.  Needs to integrate sprites with constants.
   > IO: GetKey done.  Need to add mostly homescreen IO stuff.
Croquette:
   > Stomping bugs
   > Internet version: On hold until I can make my website less boring/broken.

Offline Quigibo

  • The Executioner
  • CoT Emeritus
  • LV11 Super Veteran (Next: 3000)
  • *
  • Posts: 2031
  • Rating: +1075/-24
  • I wish real life had a "Save" and "Load" button...
    • View Profile
Re: Your Projects - Post and Critique
« Reply #512 on: January 14, 2011, 07:32:39 pm »
Also, what Michael_Lee has shown you is accessing bytes in ram using pointers ex: {L1+5}.  However, bytes only allow you values between 0-255 (or -128 to 127 if you sign extend them with "sign{").  That's fine if this is just a "Screen X" and "Screen Y" since the numbers will never get that big anyway.  But if you need numbers that go higher than that, you have to use words which are 2 byte numbers.  This is how the regular Axe variables work.  That gives you values between 0-65535 which is much larger.  All you have to do to use them is add an r to the end of the closing bracket ex: {L1+5}r  That would use both bytes {L1+5} and {L1+6} to hold the 2 byte number.
___Axe_Parser___
Today the calculator, tomorrow the world!

Offline XVicarious

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 485
  • Rating: +45/-28
  • I F**king Love Twisty Puzzles
    • View Profile
    • XVicarious
Re: Your Projects - Post and Critique
« Reply #513 on: January 14, 2011, 07:56:16 pm »
Collision checking?  Do you mean making sure enemies never intersect?

If we keep the amount of enemies fairly low (under a hundred, probably), then you could just take a brute force method - randomly generate two numbers for X and Y coordinates, check those numbers against every other enemy's coordinates, then if the absolute difference is 7 or less, then either attempt select another random slot, or add/subtract the appropriate amount of numbers to get the enemies not to intersect.

Edit: You probably meant bullets - in that case, just use the same checks you did with variables, only because all of your data is in what is effectively a list, do the checks in a for loop.

So since my current check is
Code: [Select]
If ((A-4<=X)and(A+4>=X))and(B=Y) i can just replace the variables I use for the enemy, with the loop, correct?

Offline Binder News

  • LV8 Addict (Next: 1000)
  • ********
  • Posts: 785
  • Rating: +46/-3
  • Zombie of Tomorrow
    • View Profile
Re: Your Projects - Post and Critique
« Reply #514 on: January 14, 2011, 07:58:22 pm »
Yep, I think. (I didn't read the rest of this)
Spoiler For userbars:







Hacker-in-training!   Z80 Assembly Programmer     Axe Programmer
C++ H4X0R             Java Coder                           I <3 Python!

Perdidisti ludum     Cerebrum non habes

"We are humans first, no matter what."
"Fame is a vapor, popularity an accident, and riches take wings. Only one thing endures, and that is character."
Spoiler For Test Results:





Offline XVicarious

  • LV6 Super Member (Next: 500)
  • ******
  • Posts: 485
  • Rating: +45/-28
  • I F**king Love Twisty Puzzles
    • View Profile
    • XVicarious
Re: Your Projects - Post and Critique
« Reply #515 on: January 14, 2011, 08:37:29 pm »
Ahh :crazy:! I used the code for the Pt-On() and it displays one of those like messed up sprite things when you do something wrong lol. I had to modify the variables a tad, and made sure that i fixed all of them properly but still it happens!  :banghead:

And I'm about to create a topic for this, so I'll link that in an edit so we don't spam up this topic too much.

Offline tincopper2

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 6
  • Rating: +0/-0
    • View Profile
Re: Your Projects - Post and Critique
« Reply #516 on: November 07, 2012, 05:02:26 pm »
Here's what I worked on for the past two days.  It's a 16 by 16 smoothscrolling movement engine.  Let me know what you think! ;D

I also wrote a little Pic to Hex program.  Put the top left corner of the sprite in the top left corner of the graphscreen.  Then set 0 (for 8*8 ) or 1 (for 16*16 ) to T on the first line of the program and run it.  I used it to give me the 16*16 hex codes that I used in the movement engine. :)
@ztrumpet , How did you get the sprites to be 16x16? When I store a value into hex I only know how to do 8x8... but I can
pt-On(x,y,A)
pt-On(x+8,y,B)
pt-On(x,y+8,C)
pt-On(x+8,y+8,D)
Which essentially uses 4 sprites just to make one which feels like a waste... Is there a way to put this into one sprite?

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55941
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: Your Projects - Post and Critique
« Reply #517 on: November 07, 2012, 05:03:56 pm »
You can use the Bitmap function, but I think it's even slower because the routine is written by Texas Instruments and is not as optimized.

Also welcome here :) , sadly ztrumpet isn't around anymore so if you need more details from an Axe expert you might have to wait for someone else's answer.
« Last Edit: November 07, 2012, 05:04:38 pm by DJ_O »

Offline squidgetx

  • Food.
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1881
  • Rating: +503/-17
  • rawr.
    • View Profile
Re: Your Projects - Post and Critique
« Reply #518 on: November 07, 2012, 05:04:35 pm »
Woah, necro! (sort of)

Welcome to the forums, tincopper2.

I'm not ztrumpet, but I can tell you that if you want to use 16x16 sprites in pure Axe, you'll have to use 4 8x8 sprites...that's the only way to do it without an Axiom or assembly coding. (or, as dj mentioned, you can use the bitmap command but that sucks if you want to get any kind of reasonable speed)

There are probably quite a few 16x16 sprite routines floating around in assembly, you could probably find one relatively easily (although if you want clipping that's a different story...)
« Last Edit: November 07, 2012, 05:06:51 pm by squidgetx »

Offline tincopper2

  • LV1 Newcomer (Next: 20)
  • *
  • Posts: 6
  • Rating: +0/-0
    • View Profile
Re: Your Projects - Post and Critique
« Reply #519 on: November 07, 2012, 05:18:39 pm »
Woah, necro! (sort of)

Welcome to the forums, tincopper2.

I'm not ztrumpet, but I can tell you that if you want to use 16x16 sprites in pure Axe, you'll have to use 4 8x8 sprites...that's the only way to do it without an Axiom or assembly coding. (or, as dj mentioned, you can use the bitmap command but that sucks if you want to get any kind of reasonable speed)

There are probably quite a few 16x16 sprite routines floating around in assembly, you could probably find one relatively easily (although if you want clipping that's a different story...)
Holy mackeral! Fast reply! Btw, thanks.

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: Your Projects - Post and Critique
« Reply #520 on: November 07, 2012, 06:00:47 pm »
You can use the Bitmap function, but I think it's even slower because the routine is written by Texas Instruments and is not as optimized.

Actually Axe got a new bitmap routine written for it that is much more functional and super fast :D I know if it is better than using 4 sprite calls, but it is nice and speedy if you have even larger moving images ^^

Offline squidgetx

  • Food.
  • CoT Emeritus
  • LV10 31337 u53r (Next: 2000)
  • *
  • Posts: 1881
  • Rating: +503/-17
  • rawr.
    • View Profile
Re: Your Projects - Post and Critique
« Reply #521 on: November 07, 2012, 08:20:29 pm »
Oh nice :D

Note that the bitmap Y offset might be kinda weird (at least in my experience it's about 3 px off )

Edit: Never mind, that *shouldn't* be a problem
« Last Edit: November 07, 2012, 08:39:52 pm by squidgetx »

Offline GinDiamond

  • LV3 Member (Next: 100)
  • ***
  • Posts: 71
  • Rating: +2/-2
  • I dont always fail at life, but when I do, I dont
    • View Profile
Re: Your Projects - Post and Critique
« Reply #522 on: November 26, 2012, 02:35:19 pm »
I'm working on a roguelike game in Axe. Here's the current code (its really just an @ sign moving around at this point):

Code: [Select]
.MAZEGAME
#ExprOn
DiagnosticOff
[3C409EA2A29E423C]->Pic1
ClrHome
0->X->Y
Repeat getKey(15)
If getKey(4)?Y>0
Y--
ElseIf getKey(1)?Y<56
Y++
ElseIf getKey(2)?X>0
X--
ElseIf getKey(3)?X<88
X++
End
Lbl DP
ClrDraw
Pt-On(X,Y,Pic1)
DispGraph
End
Return

How would I add walls/floor tiles? Like:
Code: [Select]
################
#..............#
#..............#
#..............#
#..............#
#..............#
#..............#
#..............#
#..............#
#..............#
################

Any help please? Thanks!

Offline Darl181

  • «Yo buddy, you still alive?»
  • CoT Emeritus
  • LV12 Extreme Poster (Next: 5000)
  • *
  • Posts: 3408
  • Rating: +305/-13
  • VGhlIEdhbWU=
    • View Profile
    • darl181.webuda.com
Re: Your Projects - Post and Critique
« Reply #523 on: November 26, 2012, 03:50:57 pm »
You'll want to do a tilemap. The tiles themselves are sprites.
For the sprites you'll want a sprite editor. There's a ton of those around here, take your pick :P
Tilemaps are kind of complicated if you're new to programming, but you can have a look around the tutorials and feel free to ask for help :)
Vy'o'us pleorsdti thl'e gjaemue

Offline GinDiamond

  • LV3 Member (Next: 100)
  • ***
  • Posts: 71
  • Rating: +2/-2
  • I dont always fail at life, but when I do, I dont
    • View Profile
Re: Your Projects - Post and Critique
« Reply #524 on: November 26, 2012, 04:08:24 pm »
Thanks, Darl181!

Could I make a matrix and then somehow make certain sprites (Pic2 would be wall tiles, Pic3 would be floor tiles) print to the screen according to the matrix?