PDA

View Full Version : Congrats, and a quick newbie question



Maebius
11-09-2011, 09:51 PM
First of all, I want to congratulate the developers (Seth, et al) for this amazing little bit of software! I'm not really a programmer, beyond some simple HTML/PHP and BASIC back in my schooldays (not even C or java... sigh. I'm old!:prophet:), but the potential in this NovaShell is really neat!

MY 7yr old son and I have been spending the last week or so with him making some stick-figure drawings in MSPaint, then going through the tutorial and slowly making "his very own video game!" replacing the tiles and entities with our own PNG paintings. I can't quite fathom the deeper concepts in making my own custom lua scripts, but so far it's been educational for us both. So, major Kudos again, for allowing us to at least throw together a "game" of our very own. (He can't wait to 'finish' more things and add a boss battle, etc once I get the warping between maps working and he 'draws' the map tiles slowly and patiently.)

My question is mostly "what should I beware/be aware of?" in terms of learning this here new fangled Programmin...:wheelchair:
I know not to ask for code snippets or such, and that "play around and debug is the best way to learn",... but I wondered if you more knowledgeable types could suggest something to concentrate on first as a solid foundation (beyond these tutorials, of course), or else things to keep in mind "for later" that a total n00b might get confused by.

Thanks in advance!
-Maebius (& kid :crazy:)

Maebius
11-14-2011, 05:53 PM
Thanks! I already broke both those rules and learned the "persistance" one first-hand since we kept messign up our "level one" map.

I'll try to fiddle with the sprites/images for things too, since I noticed that it has been acting a bit strange when I tried to import two more "enemy" dragons (from the tutorials, but using our own MS painted images, which are NOT even numbers of pixels apparently.)

Now, to the challenge of figuring out how dink or treeworld works to damage enemies! With that, our first "game" will be ready to share with the rest of the family and write up as a possible extra curricular school project. I cant' wait! :)

Hmm, just to clarify that, by powers of two, do you mean actual powers of two, or divisible by two? The stock 40x40 tiles that are used in the example, would not be true Powers of Two, the way I am reading this. They would have to be 64x64 or 32x32?? Hmm...

Seth
11-15-2011, 04:59 AM
Hey, that's really cool that you're working on a game with your kid, Maebius. Sorry Novashell is so tricky to use.. :sweatdrop: I have kids too and fantasize about a really easy to use game making app for iPad I want to make.. someday.

Maebius
11-16-2011, 01:28 PM
Ahh, that is starting to make sense. Thanks to both of you.
From a practical 'logic' I understand what you mean about the collisions. Now to figure out the syntax and technical side of this LUA scripting. Slow going, but almost there.
I'll post a zip of the "level one" once I manage to get the combat working.

My son wants to have two actions (since it's a top-down tile map like Dink/zelda). One is the basic "punch" like Dink/TreeWorld seems to use. He ALSO of course wants the space/jum,p key to be "special attack" like wind/fire/earth/ice that does extra damage ( I'll tackle things like mana/Spellpoints or cooldown timers for that someday later).

edit: I'm guessing you'd use similar functions, just use different numbers as parameters for that 'collision' onDamage(#,#,#,#) function.

Loving the ease of this so far though, even just to run around and make maze-maps!!!

Maebius
11-25-2011, 03:51 PM
Slowly working through to re-learn the sort of thinking that is required for "programming", and had a few questions. (Don't feel bad about the complexity, it's pretty easy for the basic, I just need to leanr proper LUA scripting, which is not your fault.:rolleyes:)

In the DinkTest I was trying to use that as a "template" for the attacking, because I still am a bit confused about the seperate Entity used for "slash" in TreeWorld. Sorry for noobness. :)

I've tried to copy over the functions, but so far I think I am missing something. If I upload the world, would it be possible to see what I may have done wrong, or incorrectly? Running around works great, and we added some more "ninja enemies", but I can't quite seem to get them to die by spamming the Attack key (ctrl). I know there's no animation to attack yet, but that might come later, as the image XML example on crayon is still a bit over my head.
I don't really want the game sample "fixed" other than possibly pointing out where I went wrong. Learning how to do it myself would be great, but I hit a wall this week, and am still stumped.

642643

Ideally, the kid wants something like the SLASH from Treeworld, but surrounding the player (as top-down) so it's like a shadowy ring (ie: A sword slash, or fire aura, or whatever the image winds up looking like), since Facing of the player is tricky for me. :)

Seth
11-27-2011, 11:29 PM
Hey Maebius (and kid!),

Got a chance to look, here is what I found:

1. When I hit control to attack, seemed like nothing was happening. So I added a LogMsg("Doing attack"); to the top of ProcessAttack() so I could hit ~ and see in the log that the function was actually running.

2. It wasn't. So there's the problem.. so why not? Well, in the script, it does properly run this:


function OnActionButton(bKeyDown)

if (bKeyDown) then
m_bAttack = true;
end
return true;
end

But that doesn't really do anything except set m_bAttack to true .. which you need to notice in the Update() function to do the "real attack". It's good to do it this way because you always know exactly in which order things like swinging, jumping, will happen, rather than doing them when the key is actually hit.

So to make it actually call ProcessAttack() I changed player.lua's update to look like this: (I only added stuff to the bottom)



//this is run every logic tick, normally we don't need to do this, but the player is a special case
function Update(step)

AssignPlayerToCameraIfNeeded(this); //make us the official player and have the camera track us,
//if we're not already, and if another entity doesn't already have this role

//this function is in player_utils.lua
local facing = ConvertKeysToFacing(m_bLeft, m_bRight, m_bUp, m_bDown);

if (facing != C_FACING_NONE) then
//they are pressing towards a direction
this:SetFacingTarget(facing); //turn towards the direction of the keys we pressed
this:GetBrainManager():SetStateByName("Walk");
else
this:GetBrainManager():SetStateByName("Idle");
end

//Seth's new stuff below here!

if (m_bAttack) then
//looks like they hit the attack button, let's do that now.
m_bAttack = false; //so we don't keep attacking until they hit the button again
ProcessAttack();
end
end

After that, my LogMsg() function was hit and it actually does something. It makes a swing noise and gives an error about the visual not being there.. but you knew that would happen.

Seth
11-28-2011, 11:07 AM
Btw - if this Novashell stuff proves to be a bit too much and you have an iPad, Touchpad or Android tablet: let me recommend Gaming App Construction Kit: http://gack.glbasic.com Looks very cool.

Maebius
11-28-2011, 11:38 AM
Got it working!
Now I can "kill the enemy ninjas" with style.
(well, the image I used for slash is a bit odd, but it's visible now, so I can fiddle with making it more with-style now!).

I was very surprised to see that it actually handled "facing" automagically, so I am now working on muddling through making the player have more than a single "health" so the enemy can attack back. I think I know how to do that now.

Many many thanks! Seeing what was missing for the attack made perfect sense and I can understand how to add functions much better now. I already added a "score" counter, so think health and such will be just as easy.

The programming is different from what I've been used to back in BASIC days, but it seems flexible enough. The "brains" and predefined functions are a lot nicer to work with to. Kudos again Seth!

petervin
06-17-2012, 01:36 PM
I've tried to copy over the functions, but so far I think I am missing something. If I upload the world, would it be possible to see what I may have done wrong, or incorrectly? Running around works great, and we added some more "ninja enemies", but I can't quite seem to get them to die by spamming the Attack key (ctrl). I know there's no animation to attack yet, but that might come later, as the image XML example on crayon is still a bit over my head.
I don't really want the game sample "fixed" other than possibly pointing out where I went wrong.:whistling: