Omnimaga: The Coders Of Tomorrow
Welcome, Guest. Please login or register.
 
Omnimaga: The Coders Of Tomorrow
25 May, 2013, 19:53:07 *
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] 2   Go Down
  Print  
Author Topic: How to move a sprite while updating greyscale??? - How??  (Read 596 times) Bookmark and Share
0 Members and 1 Guest are viewing this topic.
Link
LV4 Regular (Next: 200)
****
Offline Offline

Gender: Male
Last Login: 22 May, 2013, 19:01:48
Date Registered: 28 August, 2012, 22:32:37
Location: Canada/USA
Posts: 116


Topic starter
Total Post Ratings: +4

View Profile WWW
« on: 08 September, 2012, 03:29:14 »
0

So, I understand grey-scale, and physics and so on, So I decided to make some sort of simple game. Except I don't get how to make a sprite move around using getkey or whatever, and still not pause the actual gray-scale updating? Can someone tell me how, to say make a small gray-scale box move around the screen? Just need an idea for the loop structure, that's all.
Logged

Yeong
Eternally Young Scarlet Moon
LV12 Extreme Poster (Next: 5000)
************
Offline Offline

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


Total Post Ratings: +260

View Profile
« Reply #1 on: 08 September, 2012, 03:41:56 »
0

simple.

Repeat getKey(15) //make sure the program quits when you press {Clear}
ClrDrawrr
your greyscale sprite goes here
DispGraphrr
your sprite movement control goes here
End

I know that it's not optimized, but it'll do. Cheesy
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 !¤¤º°¨¨°º¤øº¤ø„¸¸ø¤º°¨„ ø¤º°¨¨°º
Link
LV4 Regular (Next: 200)
****
Offline Offline

Gender: Male
Last Login: 22 May, 2013, 19:01:48
Date Registered: 28 August, 2012, 22:32:37
Location: Canada/USA
Posts: 116


Topic starter
Total Post Ratings: +4

View Profile WWW
« Reply #2 on: 08 September, 2012, 03:44:11 »
0

simple.

Repeat getKey(15) //make sure the program quits when you press {Clear}
ClrDrawrr
your greyscale sprite goes here
DispGraphrr
your sprite movement control goes here
End

I know that it's not optimized, but it'll do. Cheesy
Okay, thanks, and one more question, why is most sprite movement multiplied by 256? it it for some specific reason?
Logged

Yeong
Eternally Young Scarlet Moon
LV12 Extreme Poster (Next: 5000)
************
Offline Offline

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


Total Post Ratings: +260

View Profile
« Reply #3 on: 08 September, 2012, 03:46:38 »
0

I'm not sure but I think they were usually related to gravity or something.
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 !¤¤º°¨¨°º¤øº¤ø„¸¸ø¤º°¨„ ø¤º°¨¨°º
parserp
Hero Extraordinaire
LV10 31337 u53r (Next: 2000)
**********
Offline Offline

Gender: Male
Last Login: 23 May, 2013, 23:14:32
Date Registered: 08 September, 2011, 02:01:43
Location: Here.
Posts: 1421


Total Post Ratings: +80

View Profile WWW
« Reply #4 on: 08 September, 2012, 03:50:27 »
0

Yes, *256 inflation is used for physics, which allows the player to move at 1/256 of a pixel at a time.
Logged

ticalc.org | Cemetech | TI-Freakware | casiocalc.org

My New Website!
Spoiler for The Rest:



A useful tool
Spoiler for bands:
Five Finger Death Punch
Disturbed
Slipknot
Linkin Park
Avenged Sevenfold
Breaking Benjamin
Skillet
30 Seconds to Mars
Link
LV4 Regular (Next: 200)
****
Offline Offline

Gender: Male
Last Login: 22 May, 2013, 19:01:48
Date Registered: 28 August, 2012, 22:32:37
Location: Canada/USA
Posts: 116


Topic starter
Total Post Ratings: +4

View Profile WWW
« Reply #5 on: 08 September, 2012, 03:51:27 »
0

Yes, *256 inflation is used for physics, which allows the player to move at 1/256 of a pixel at a time.
How does that work, say you have to move 2, then *256, it becomes 512, doesn't that go over the limit of 96 px?
Logged

parserp
Hero Extraordinaire
LV10 31337 u53r (Next: 2000)
**********
Offline Offline

Gender: Male
Last Login: 23 May, 2013, 23:14:32
Date Registered: 08 September, 2011, 02:01:43
Location: Here.
Posts: 1421


Total Post Ratings: +80

View Profile WWW
« Reply #6 on: 08 September, 2012, 03:54:10 »
0

No, when you display it, you do /256, which means that you have to add 512 to the value in order to move 2 pixels. It's kind of hard to explain it in a condensed form, I'd try looking at some of the many physics tutorials. Smiley
Logged

ticalc.org | Cemetech | TI-Freakware | casiocalc.org

My New Website!
Spoiler for The Rest:



A useful tool
Spoiler for bands:
Five Finger Death Punch
Disturbed
Slipknot
Linkin Park
Avenged Sevenfold
Breaking Benjamin
Skillet
30 Seconds to Mars
Link
LV4 Regular (Next: 200)
****
Offline Offline

Gender: Male
Last Login: 22 May, 2013, 19:01:48
Date Registered: 28 August, 2012, 22:32:37
Location: Canada/USA
Posts: 116


Topic starter
Total Post Ratings: +4

View Profile WWW
« Reply #7 on: 08 September, 2012, 03:54:59 »
0

No, when you display it, you do /256, which means that you have to add 512 to the value in order to move 2 pixels. It's kind of hard to explain it in a condensed form, I'd try looking at some of the many physics tutorials. Smiley
K, and this is used in pretty much all physics right?
Logged

leafy
Coder Of Tomorrow
LV10 31337 u53r (Next: 2000)
*
Offline Offline

Gender: Male
Last Login: Yesterday at 20:10:08
Date Registered: 26 December, 2010, 05:27:03
Location: the ninth circle of hell
Posts: 1545


Total Post Ratings: +371

View Profile WWW
« Reply #8 on: 08 September, 2012, 05:13:04 »
0

No, when you display it, you do /256, which means that you have to add 512 to the value in order to move 2 pixels. It's kind of hard to explain it in a condensed form, I'd try looking at some of the many physics tutorials. Smiley
K, and this is used in pretty much all physics right?
It's certainly the most optimized number for position inflation. In fact, since Axe is big-endian, instead of doing VAR/256, you can do {°VAR+1}. This method also has a lot of uses outside of physics, too.
Logged

In-progress: Blastlabs, TMJO, qb?, VVVVVV?
Finished: Tag, Tap, MFQT, Nyan
Dead: Graviter
calc84maniac
Epic z80 roflpwner
Coder Of Tomorrow
LV11 Super Veteran (Next: 3000)
*
Offline Offline

Gender: Male
Last Login: Today at 16:59:06
Date Registered: 28 August, 2008, 05:09:05
Location: Right behind you.
Posts: 2735


Total Post Ratings: +373

View Profile
« Reply #9 on: 08 September, 2012, 06:26:23 »
0

No, when you display it, you do /256, which means that you have to add 512 to the value in order to move 2 pixels. It's kind of hard to explain it in a condensed form, I'd try looking at some of the many physics tutorials. Smiley
K, and this is used in pretty much all physics right?
It's certainly the most optimized number for position inflation. In fact, since Axe is big-endian, instead of doing VAR/256, you can do {°VAR+1}. This method also has a lot of uses outside of physics, too.
It's actually little-endian, but yes, that is the correct method.
Logged

"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman
leafy
Coder Of Tomorrow
LV10 31337 u53r (Next: 2000)
*
Offline Offline

Gender: Male
Last Login: Yesterday at 20:10:08
Date Registered: 26 December, 2010, 05:27:03
Location: the ninth circle of hell
Posts: 1545


Total Post Ratings: +371

View Profile WWW
« Reply #10 on: 08 September, 2012, 06:27:52 »
0

Wait, if you use +1 to access the high byte, why isn't it big endian? Tongue I've been deceived Big frown
Logged

In-progress: Blastlabs, TMJO, qb?, VVVVVV?
Finished: Tag, Tap, MFQT, Nyan
Dead: Graviter
calc84maniac
Epic z80 roflpwner
Coder Of Tomorrow
LV11 Super Veteran (Next: 3000)
*
Offline Offline

Gender: Male
Last Login: Today at 16:59:06
Date Registered: 28 August, 2008, 05:09:05
Location: Right behind you.
Posts: 2735


Total Post Ratings: +373

View Profile
« Reply #11 on: 08 September, 2012, 06:31:20 »
0

Big endian means that the highest byte comes first. Little endian means the lowest byte comes first.
Logged

"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman
leafy
Coder Of Tomorrow
LV10 31337 u53r (Next: 2000)
*
Offline Offline

Gender: Male
Last Login: Yesterday at 20:10:08
Date Registered: 26 December, 2010, 05:27:03
Location: the ninth circle of hell
Posts: 1545


Total Post Ratings: +371

View Profile WWW
« Reply #12 on: 08 September, 2012, 06:32:21 »
0

Ugh, I got big endian and little endian mixed up Big smile Big endian sounds like the big byte should be at the end, that's my justification.
* leafy runs
Logged

In-progress: Blastlabs, TMJO, qb?, VVVVVV?
Finished: Tag, Tap, MFQT, Nyan
Dead: Graviter
Link
LV4 Regular (Next: 200)
****
Offline Offline

Gender: Male
Last Login: 22 May, 2013, 19:01:48
Date Registered: 28 August, 2012, 22:32:37
Location: Canada/USA
Posts: 116


Topic starter
Total Post Ratings: +4

View Profile WWW
« Reply #13 on: 08 September, 2012, 22:23:58 »
0

Hmm, well I tried this according to what yeong said: but it isn't working? Whats wrong >.>


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
:.A
:AsmComp(SPEEDKEY)
:[7E81BD817E18183C]→Pic1
:[7EFFC3FF7E18183C]→Pic2
:ClrDraw{^r}{^r}
:0→X→Y
:While 1
:Zoom Out→A
:Pt-Off(X/256,Y/256,Pic1)
:Pt-Off(X/256,Y/256,Pic2){^r}
:DispGraphClrDraw{^r}{^r}
:If A=1
:Y--
:End
:If A=2
:X--
:End
:If A=3
:X++
:End
:If A=4
:Y++
:End
:EndIf getKey(15)
Logged

leafy
Coder Of Tomorrow
LV10 31337 u53r (Next: 2000)
*
Offline Offline

Gender: Male
Last Login: Yesterday at 20:10:08
Date Registered: 26 December, 2010, 05:27:03
Location: the ninth circle of hell
Posts: 1545


Total Post Ratings: +371

View Profile WWW
« Reply #14 on: 08 September, 2012, 22:33:25 »
0

Hmm, well I tried this according to what yeong said: but it isn't working? Whats wrong >.>


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
:.A
:AsmComp(SPEEDKEY)
:[7E81BD817E18183C]→Pic1
:[7EFFC3FF7E18183C]→Pic2
:ClrDraw{^r}{^r}
:0→X→Y
:While 1
:Zoom Out→A
:Pt-Off(X/256,Y/256,Pic1)
:Pt-Off(X/256,Y/256,Pic2){^r}
:DispGraphClrDraw{^r}{^r}
:If A=1
:Y--
:End
:If A=2
:X--
:End
:If A=3
:X++
:End
:If A=4
:Y++
:End
:EndIf getKey(15)

I'm assuming that when you press the enter keys, the sprite doesn't appear to move. That's totally normal, because you're only subtracting or adding one to each variable, and it takes 256 such adds or subtracts to move one pixel. To mitigate this, you might try Y-25->Y instead of Y-- and see if that makes a difference.
« Last Edit: 08 September, 2012, 22:33:36 by leafy » Logged

In-progress: Blastlabs, TMJO, qb?, VVVVVV?
Finished: Tag, Tap, MFQT, Nyan
Dead: Graviter
Pages: [1] 2   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.281 seconds with 30 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.