I do like the 98 version better, to me it reads a little easier. But does it take up more memory since its 2 lines instead of 1 line ?
You can do things 98 style if you want, other version isnāt mandatory.
Bear in mind though that you donāt do the initialisation immediately underneath the declaration as Jonneās example might suggest, the initialisation happens elsewhere (usually in the constructor).
Personally I prefer C++11 style because itās easy to see what the default value of a member variable is without having to look elsewhere (i.e. at the constructor).
As far as C++98 vs C++11 goes there are much bigger changes than that.
(Though I suspect mbed online is probably C++03, Iād be surprised if it were C++98.)
Just noticed this : https://wiki.python.org/moin/TOOWTDI
If Python really is simpler, in the way you can only do it one way, i might wanna try that. ( @Hanski)
Python is an easier language for beginners, but thereās a memory overhead involved in using it and programs written with it wonāt be as fast as those written with C++.
(I donāt know how big the memory and speed difference is though.)
C++ is more flexible and (arguably) more powerful but that power and flexibility comes at the cost of complexity.
Conversely Python is a lot less complicated but that simplicity comes with restrictions in flexibility and (arguably) power.
you can just write more in a c style, you dont have to use everything c++ is giving you like templates and even classes
i mainly miss auto
in C++98
True, though the only reason I can think for avoiding them is if you donāt understand them.
Iād miss nullptr
, constexpr
, enum class
, auto
, decltype
, static_assert
, template aliases, rvalue referencesā¦ C++11 was a really big change.
there allot of things in c++ i dont understand, and i did a cource on it XD
@wuuff hereĀ“s an improved version, there was only some mistakes with FPSā¦
Also i added the scrolling background
Racers A 1.1.bin (46,6 KB)
Itās a lot better. I like how everything moves faster, including your car. However, I still got trapped a few times, although itās a lot rarer. It seems like the background isnāt scrolling for me though.
What do you mean by that? Isnāt it working or looks it just crappy?
can you show the scrolling code?
i just came across a similar issue giving odd behaviour
He hey @Zuzu36 ! The first game I loaded to Pokitto on my new mac was Racers! Weāre playing it now and we like it. Good job!
EDIT: it reminds me of driving on German Autobahn ā¦ equally stressful!
It isnāt moving at all. It looks like it did in the other version.
Same here, just tested it on my pokitto, ground is not moving. Also because cars are not animated they donāt seem to be driving, as much as falling/sliding.
What size are your cars (pixels)? If I have some spare time on the weekend I can look into making some and look into adding some simple animation (even just moving the white pixel on tires would do wonders to give the illusion of driving).
if he did what i suggested to minimise the sprite duplication, every part should be its own little sprite
so you could animate the wheels independent from the car body
Ohhhhhā¦ I made a stupid mistake. I forgot to move the background, scrolling should work now:
Racer A 1.2.bin (46,6 KB)
Thanks [quote=āVonBednar, post:34, topic:627ā]
If I have some spare time on the weekend I can look into making some and look into adding some simple animation (even just moving the white pixel on tires would do wonders to give the illusion of driving).
[/quote]
Thanks, but I want that the game is as easy as possible --> No animations
No, I just used the whole racer picture. (I know, its not best choice, but easier for my )
I must add that IĀ“m really happy that you try helping me, but I just want to program these game to understand whatĀ“s going on in programming . Maybe I need to use little sprite parts (@adekto) or animated textures (@VonBednar) in my next game. As soon as the game is ready, I will share the code and everybody can add what he wantĀ“s
you be surprised how easy it is the things we are talking about
theres ofcource classes but maybe stick to a simpler function model
void drawRacer(int x, int y, int color){
game.display.drawBitmap(x,y,wheelSprite);
game.display.drawBitmap(x+8,y,wheelSprite);
game.display.drawBitmap(x,y+7,wheelSprite);
game.display.drawBitmap(x+8,y+7,wheelSprite);
game.display.rotatePalette(color);
game.display.drawBitmap(x+3,y,bodySprite);
game.display.rotatePalette(-color);
}
and wheel animation something as simple as this would do
// sprite
const uint8_t wheel[][6]={
{2,4,
0x01, 0x00, 0x00, 0x00},
{2,4,
0x00, 0x01, 0x00, 0x00},
{2,4,
0x00, 0x00, 0x01, 0x00},
{2,4,
0x00, 0x00, 0x00, 0x01},
};
//how do draw it
game.display.drawBitmap(x,y,wheel[frame]);
//how to loop the animation
frame ++;
frame = frame%4;
I see, itĀ“s easy. But it will be complicaded because of my differend vehicel types: At the moment there tanks and a few cars are using colored wheels/spoilers.
Thanks for helping, i will see if i make use of it, probably not in this game but i have already ideas for more
sure thing, but adding those extra versions or modification is also trivial.
ether way i hope you look into it
also if you wanna know how the sprite file format works just tell me cuz i kinda made that by hand without using an image converter
Iām just getting a solid grey background on the newest version, with no road drawn at all. Can anybody else confirm itās not just me?