Author Topic: [Project] Sniper 101.  (Read 39892 times)

0 Members and 3 Guests are viewing this topic.

Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: [Project] Sniper 101.
« Reply #30 on: October 21, 2010, 09:13:13 pm »
how would you put that in though?
It seems like that would be more inefficient.


Anyone got an idea to make everything but in the view of the scope black?

I was saying that that's what you're doing with the Rand^24/25+x->x. It's only every 13 cycles on average that X is incremented by a nonzero amount.

And for your scope thing, in Psuedo-code a routine might look like this.
Code: [Select]
ClrDraw
Rect(0,0,96,65)
...
RectI(X,Y,X+2R,Y+2R)     \\Clears the rectangle that squares the circle of the Scope
Fill outer perimeter of scope     \\Fill the parts of the rectangle that are supposed to be black
Draw background stuff to appear
Rect(X,Y,X+2R,Y+2R)     \\returns screen to original setup

Don't bother restricting your pictures only to the Scope. If the rest of the screen is black, then drawing black on top won't do anything and will save program size, if not execution speed.

EDIT: I'd recommend using a bitmap to fill the outer perimeter of the scope.
« Last Edit: October 21, 2010, 09:23:24 pm by Qwerty.55 »
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

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: [Project] Sniper 101.
« Reply #31 on: October 21, 2010, 09:14:40 pm »
what I mean is draw the first pic and change it to the second pic.  then you can draw inside the circle to get something like the third pic.
« Last Edit: October 21, 2010, 09:17:00 pm by Darl181 »
Vy'o'us pleorsdti thl'e gjaemue

Offline Happybobjr

  • James Oldiges
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2325
  • Rating: +128/-20
  • Howdy :)
    • View Profile
Re: [Project] Sniper 101.
« Reply #32 on: October 21, 2010, 09:49:21 pm »
what I mean is draw the first pic and change it to the second pic.  then you can draw inside the circle to get something like the third pic.


How did you make that circle!?!!!!!
It is amazing compared to mine.


how would you put that in though?
It seems like that would be more inefficient.


Anyone got an idea to make everything but in the view of the scope black?

I was saying that that's what you're doing with the Rand^24/25+x->x. It's only every 13 cycles on average that X is incremented by a nonzero amount.

And for your scope thing, in Psuedo-code a routine might look like this.
Code: [Select]
ClrDraw
Rect(0,0,96,65)
...
RectI(X,Y,X+2R,Y+2R)     \\Clears the rectangle that squares the circle of the Scope
Fill outer perimeter of scope     \\Fill the parts of the rectangle that are supposed to be black
Draw background stuff to appear
Rect(X,Y,X+2R,Y+2R)     \\returns screen to original setup

Don't bother restricting your pictures only to the Scope. If the rest of the screen is black, then drawing black on top won't do anything and will save program size, if not execution speed.

EDIT: I'd recommend using a bitmap to fill the outer perimeter of the scope.

I don't know anything about bitmaps
School: East Central High School
 
Axe: 1.0.0
TI-84 +SE  ||| OS: 2.53 MP (patched) ||| Version: "M"
TI-Nspire    |||  Lent out, and never returned
____________________________________________________________

Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: [Project] Sniper 101.
« Reply #33 on: October 21, 2010, 09:55:02 pm »
You're doing this in Axe, right?

Then let's say you have the Hex code [FFFFFFFF] for your image. To display the bitmap, just tack on the rows and columns to the first two bytes of the hex data (in that order) and use Bitmap(X,Y,hex code)

Code: [Select]
[0202FFFFFFFF]->Pic1
Bitmap(0,0,Pic1)

This will display a 2x2 bitmap at (0,0). At least I think it will.
« Last Edit: October 21, 2010, 09:55:54 pm by Qwerty.55 »
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

Offline Happybobjr

  • James Oldiges
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2325
  • Rating: +128/-20
  • Howdy :)
    • View Profile
Re: [Project] Sniper 101.
« Reply #34 on: October 21, 2010, 10:57:04 pm »
but what is a bitmap??
School: East Central High School
 
Axe: 1.0.0
TI-84 +SE  ||| OS: 2.53 MP (patched) ||| Version: "M"
TI-Nspire    |||  Lent out, and never returned
____________________________________________________________

Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: [Project] Sniper 101.
« Reply #35 on: October 21, 2010, 11:27:23 pm »
A bitmap is like a sprite. Actually, it would be more correct to say that a sprite is basically a bitmap that moves around. In Axe, with the Spriting commands, what you're actually doing is designating a bitmap which is then drawn to the buffer. In other words, a bitmap is an image. With the Bitmap command, you can draw sprites that are not of the 8x8 size Axe uses.
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

Offline Happybobjr

  • James Oldiges
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2325
  • Rating: +128/-20
  • Howdy :)
    • View Profile
Re: [Project] Sniper 101.
« Reply #36 on: October 21, 2010, 11:47:50 pm »
so why bother making Pt-on command?
are there benefits?
School: East Central High School
 
Axe: 1.0.0
TI-84 +SE  ||| OS: 2.53 MP (patched) ||| Version: "M"
TI-Nspire    |||  Lent out, and never returned
____________________________________________________________

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55943
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: [Project] Sniper 101.
« Reply #37 on: October 21, 2010, 11:53:37 pm »
Because Bitmap uses a TI-OS routine that is slower than pt-on, but its advantage is that you don't need over 9000 pt-on commands to display many 32x32 sprites on the screen. Also I think bitmap only supports the AND logic, not XOR/OR. Pt-On/Off/change, on the other hand, gives more freedom and are faster.

Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: [Project] Sniper 101.
« Reply #38 on: October 21, 2010, 11:54:14 pm »
so why bother making Pt-on command?
are there benefits?

It's easier to use and I believe it's more efficient because the algorithm doesn't have to handle an arbitrary amount of data. The 8x8 status is also a power of 2, so the Pt-On algorithm can be optimized that way.
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

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: [Project] Sniper 101.
« Reply #39 on: October 22, 2010, 01:03:11 am »
How did you make that circle!?!!!!!
It is amazing compared to mine.
I used msPaint ;) (on the computer)

btw in case you don't know axe can do Circle( .
« Last Edit: October 22, 2010, 01:04:00 am by Darl181 »
Vy'o'us pleorsdti thl'e gjaemue

Offline Happybobjr

  • James Oldiges
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2325
  • Rating: +128/-20
  • Howdy :)
    • View Profile
Re: [Project] Sniper 101.
« Reply #40 on: October 22, 2010, 12:20:53 pm »
:)

i  am using 4 pt-on commands now
School: East Central High School
 
Axe: 1.0.0
TI-84 +SE  ||| OS: 2.53 MP (patched) ||| Version: "M"
TI-Nspire    |||  Lent out, and never returned
____________________________________________________________

Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: [Project] Sniper 101.
« Reply #41 on: October 22, 2010, 12:51:05 pm »
:)

i  am using 4 pt-on commands now

In that case it might be more efficient to consider a Bitmap.
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

Offline Builderboy

  • Physics Guru
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5673
  • Rating: +613/-9
  • Would you kindly?
    • View Profile
Re: [Project] Sniper 101.
« Reply #42 on: October 22, 2010, 01:53:39 pm »
Note: i ran some tests and bitmaps take about 15 times as much time as 4 sprites D:

Offline Happybobjr

  • James Oldiges
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2325
  • Rating: +128/-20
  • Howdy :)
    • View Profile
Re: [Project] Sniper 101.
« Reply #43 on: October 22, 2010, 02:28:15 pm »
wow!  Thanks Builderboy.

I made a couple of changes in my code and saved over 300 bytes.

I had a empty circle then drew cross hair in it.
I changed it so the cross hairs were built into the circle...  ;)

This is coming nicly for a small project.
School: East Central High School
 
Axe: 1.0.0
TI-84 +SE  ||| OS: 2.53 MP (patched) ||| Version: "M"
TI-Nspire    |||  Lent out, and never returned
____________________________________________________________

Offline Munchor

  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6199
  • Rating: +295/-121
  • Code Recycler
    • View Profile
Re: [Project] Sniper 101.
« Reply #44 on: October 22, 2010, 02:33:25 pm »
I opted for 'Other-Specify'.

You should have like three, four or even 5 guys going around(and more will come). You have to keep shooting them.
If you fail, no problem.

More and more guys will come, and you have to eliminate them as they come.

If, for example, 20 guys are on the screen, you lose, set highscore :)