Super Maruino Land

Advice on general approaches or feasibility and discussions about game design

Re: Super Maruino Land

Postby Valden » Thu Jul 09, 2015 4:18 pm

It's easy. Imagine 0b1111 1010 is your number. For selecting parts of the byte, you just have to use the "shift" operator. This operation moves the bits in the number left or right. So if I shift 4 bit to the right, the number will looks like this : 0b 0000 1111. In C, you use << for shifting bits to the left, and >> for shifting bits to the right. You have to do x >> y, wher x is your number and y the number of bits you what to shift.

So if you what to select the first part of the number, you do number >> 4.

The the second part (1010 in our case) you have to use a bit mask to 'mask' the first part. For that, you use the & (bit and) like this :
number & 0b0000 1111.

For more info check this : https://en.wikipedia.org/wiki/Bitwise_operation#AND and https://en.wikipedia.org/wiki/Bitwise_operation#Arithmetic_shift

TL;DR :
Code: Select all
left_half = number >> 4;
//if it doesn't works, try left_half = (number >> 4) & 0b 0000 1111;
right_half = number & 0b0000 1111;
User avatar
Valden
 
Posts: 31
Joined: Mon Jun 08, 2015 5:33 pm

Re: Super Maruino Land

Postby Marcus » Thu Jul 09, 2015 5:01 pm

awesome101 wrote:Hey guys I'm working on another console called pigrrl:
Image


Very, very nice! :-)

Who would have thought that it would be possible to build own consoles, manufacture plastic cases, easily program games when we where kids...
Marcus
 
Posts: 143
Joined: Fri Jan 09, 2015 6:51 pm

Re: Super Maruino Land

Postby adekto » Thu Jul 09, 2015 8:03 pm

wel its basicly a raspery pi running a emulator
but its prety nice
User avatar
adekto
 
Posts: 448
Joined: Tue Feb 25, 2014 9:47 pm
Location: belgium

Re: Super Maruino Land

Postby awesome101 » Thu Jul 09, 2015 10:02 pm

Yeah it's pretty easy to make too. :D
awesome101
 
Posts: 159
Joined: Sat Jun 20, 2015 6:56 pm

Previous

Return to Project Guidance & Game development

Who is online

Users browsing this forum: No registered users and 105 guests

cron