Forum Replies Created
-
AuthorPosts
-
trodossMember
Just as an update:
This game is still being worked on (albeit slowly) as I have time. It is one of many projects I am working on.Thanks,
–trodosstrodossMember@moe wrote:
Sooooo yes I finished my game fusion!
Congratulations!
I haven’t had a chance to see what your issue may be, as I don’t have my Hackvision available at the moment.Oh and yes and Michael if you plan to make a Hackvision v2: If it’s possible, could you please add a on/off switch? But thats just an idea I wanted to share..
That is a pretty common suggestion among a lot of Arduino board designs 😉 It is a fine balance between extra components (adding to cost) versus adding “features.” I think for Michael to make a significant revision to Hackvision there would have to be a lot of interest.
Since there are a number of pins brought out, you can always try your hand at “expanding” your Hackvision (soldering on some pin headers on the expansion areas).
trodossMemberJust remember that Arduino programs are just C/C++ programs with the main() hidden. You should study Arduino and C/C++ before going much further with game development.
My recommendation would be to start with some examples on the Arduino site:
http://arduino.cc/en/Tutorial/HomePageThat should help you get a feel for how the Arduino “works.” Syntax is C/C++ as Michael has mentioned. It may answer for you some of the questions you have. If you are comfortable you are with the basic syntax, then certainly try some of the more advanced syntax. C++ is notorious for things like “short-circuit evaluation” that you don’t *have* to use, yet you are bound to see. Since you are already familiar with Python, you may be more used to whitespace indention rather than {} (curly braces) to indicate “scope.” Keeping track of when you have started/ended a code block, and tracing where you have missed a “}” might take a while to get used to, but you will get used to it. I would recommend learning C/C-like syntax regardless, as it will serve you well in the future 😉 The Arduino environment (IDE/syntax) is a great place to get started. Since you are not new to programming, you should pick it up fast.
I would avoid function pointers and interrupt handlers for now. Looking at the “wiring under the board” so to speak can be confusing to follow unless you have a solid understanding of how the underlying gcc compiler (avr-gcc) works. Frankly you can get by (and may be perfectly happy) not going to that low of a level.
If you feel comfortable with the syntax, you might want to investigate the examples in the TVOut library as well. Try a few simple things and build off of them (maybe .print(), .draw_circle(), .draw_line() …etc.) In doing so it will help you understand some of the syntax, and how to use the data types.
Hopefully that helps.
trodossMemberMoe,
Here is code that might help a little. It is code from one of my sketches that I tried to make a little more “generic”
/*
Game Template (?) -- At least maybe a start
*/
#include
#include
#include
#include
#define SCREENWIDTH 128
#define SCREENHEIGHT 96
boolean palJumper;
#define PALpin 12
#define PAUSE_BETWEEN_ACTIONS 100
#define GAME_TITLE 0
#define GAME_PLAYING 1
#define GAME_WON 3
#define GAME_OVER 4
TVout TV;
char game_state;
void setup()
{
palJumper = digitalRead( PALpin );
TV.begin( palJumper ? NTSC : PAL, SCREENWIDTH, SCREENHEIGHT );
TV.select_font(font4x6);
//generate random number (ouside of standard Arduino random, because
//it needs to be 'read' in code outside the main sketch
randomSeed(analogRead(0));
start_title();
}
void loop()
{
static long next_action = 0;
switch (game_state)
{
case GAME_TITLE:
case GAME_OVER:
case GAME_WON:
if (TV.millis() >= next_action)
{
//wait for a button to be pressed to continue
if (Controller.firePressed())
{
//check to see what we are doing when we start the game
if (game_state > GAME_TITLE)
{
if (game_state == GAME_WON)
{
//if the game has been won, handle action here
} else {
//if the game was just over (died) then reset game elements
}
}
game_state = GAME_PLAYING;
start_game();
}
next_action = TV.millis() + PAUSE_BETWEEN_ACTIONS;
}
update_sound();
break;
case GAME_PLAYING:
if (TV.millis() >= next_action)
{
if (Controller.upPressed())
{
//handle 'up' being pressed
}
if (Controller.downPressed()){
{
//handle 'down' being pressed
}
if (Controller.rightPressed())
{
//handle 'right' being pressed
}
if (Controller.leftPressed())
{
//handle 'left' being pressed
}
if (Controller.firePressed())
{
//handle 'fire' being pressed
}
//build in a delay between actions (optional)
next_action = TV.millis() + PAUSE_BETWEEN_ACTIONS;
//handle game elements here
}
break;
}
}
void start_game()
{
//clear the contents of the screen
TV.clear_screen();
//start the game
game_state = GAME_PLAYING;
}
void start_title()
{
//clear the contents of the screen
TV.clear_screen();
//set the state to show the title screen
game_state = GAME_TITLE;
//to do: show title here
}
void start_game_over()
{
//clear the contents of the screen
TV.clear_screen();
game_state = GAME_OVER;
//to do: show game over message here
}
void start_game_won()
{
//clear the contents of the screen
TV.clear_screen();
game_state = GAME_WON;
//to do: show game won message here
}
trodossMember@Michael wrote:
That looks great. Don’t worry about a video — I can make that, and I really want to host the videos on the nootropicdesign YouTube account anyway.
I haven’t been able to get the video capture to work for anything other than snapshots anyway, so no worries there 😉
And, thanks for the interest! I should hopefully have enough time to finish the game soon.
–trodoss
trodossMemberThe video looks great! Thanks for posting it (and the game).
I hope everyone enjoys it.–trodoss
trodossMemberOh, and the reason why it is “elventure2” is because of the Arduino IDE 😉 It gets confused if you have sketches/folders with the same name. I was trying to keep it organized on my end.
If you think it will be too confusing, feel free to change the folder/sketch name before posting it on your site. That wouldn’t bother me in the least.
There may be an *actual* Elventure 2 in the future, depending on how well this one is received. I have a few more shorter-term game projects that I plan on putting together first.
trodossMemberHello, me again!
I have the updated version of the source uploaded. If you could make sure that everything works before you upload, then feel free to post it on the site. It now includes sound effects and uses some of the bitmap functions.
If you do find anything let me know and I will try to get it fixed ASAP so you can get it posted.
License may not be a huge deal. I have been using GNU GPL v2 in the source (you can find the source at http://code.google.com/p/trodoss-arduino/ as well). If you need it under a different one (like MIT) let me know and I can change it.
Thanks! Now I have to order a Hackvision 😉
–trodosstrodossMemberThanks! Glad you like it. And…it works on Hackvision! Awesome!!
I plan on making the animation a little more smooth — using some of the techniques of overlaying like Parachute and Asteroids use (provided that it is ok), and adding sound effects into the sound engine so it is that much more “game like.” Not having SFX when monsters die or you gain hearts takes away from it a little.
-
AuthorPosts