Topic:   HTML5 Docs - I need your input   (Read 44685 times)


0 Members and 5 Guests are viewing this topic.

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
HTML5 Docs - I need your input
« on: December 26, 2011, 11:17:28 PM »
Quote
HTML5 GameMaker Help Documentation:

The HTML5 GameMaker is an online game maker with the sole purpose of allowing you to make online HTML5 games in a faster and easier manner.
Copyright to the Game Maker's Garage. Created by programmer Matthew French(AKA Gan).

Syntax:
If-Statement:
If 1 = 1 Then
   //Do Stuff
End If

For loop:
For i = 1 to 5
   //Do stuff involving i
Next

Declaring variables: (Should var be used to declare variables?)
myNum = 2;
myString = "cow";

Should all variables created be global? Or should they be local unless specified as global variables?

General Methods:
Game Open - Gets called when the game opens. This is where you load media.
Key Down - Gets called when a key is pressed down.
Key Up - Gets called when a key is released.
Mouse Down - Gets called when the mouse clicks.
Mouse Up - Gets called when the mouse is released.
Mouse Move - Gets called when the mouse moves.
Timer Tick - Gets called when the timer ticks. Should the timer's interval be changeable? Should there even be a main timer? Should the player be allowed to make their own timer that calls a method?
Game Close - Gets called when the application closes.

Methods:
Custom methods can be created that are callable.

Classes:
The main class contains the General Methods.
Custom classes can contain methods that can be called by CustomClass.CustomMethod().
Custom objects can be created from custom classes:
spaceship = new SpaceShip()
Global variables of custom objects can be set by:
spaceship.shield = 50

Commands:
I'm writing the syntax and structure for the HTML5 GameMaker. It'll guide me in my quest of creation.
I need your help, I'm determining how to set up things like creating variables. Global and local, declarations, ect...

Plus it'd be useful to know all the math functions, drawing, and input commands you guys want.

If you want to help out, just post your ideas and wants or quote the docs above and add stuff to it.
« Last Edit: December 26, 2011, 11:33:29 PM by Gan »

Circuit


  • GMG-er

  • **


  • Posts: 299

  • blast from the past
Re: HTML5 Docs - I need your input
« Reply #1 on: December 27, 2011, 01:28:29 AM »
This is great.  I'm really looking forward to using HTML5 GameMaker!

Concerning variables, I think it's really important to allow the user to define the scope of a variable: class-level, method-level, or block-level.  The scope should be implicit in the placement of the variable declaration.  A variable should be discarded from memory once it goes out of scope.

This is just my preference.  I recently finished a class on OOP in Java, and I really want to keep programming with that paradigm as much as possible.
« Last Edit: December 27, 2011, 01:49:50 AM by Circuit »

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: HTML5 Docs - I need your input
« Reply #2 on: December 27, 2011, 01:58:54 AM »
Sounds reasonable.

When defining a class, I can allow the definition of global variables.
var myGlobalVar = 2;

These global variables can be used anywhere. For objects, the global variables would be specific to that object.

Then local variables could be defined in methods and such:
var myLocalVar = 2;

I guess the user will be forced to initially declare variables. Should we use var or let to declare?
« Last Edit: December 27, 2011, 02:12:38 AM by Gan »

Circuit


  • GMG-er

  • **


  • Posts: 299

  • blast from the past
Re: HTML5 Docs - I need your input
« Reply #3 on: December 27, 2011, 05:52:44 PM »
I think var is better for declaration.  It has a clear meaning.  Let is more generic.

Connors


  • ^ This guy is amazing.

  • ****


  • Posts: 2374

  • It's a secret to everyone...
Re: HTML5 Docs - I need your input
« Reply #4 on: December 27, 2011, 06:32:57 PM »
Any reason you aren't declaring variables as a type like an int float or string? How would you handle that?
Warning: The above post may have been modified multiple times.

"In a great game, the character must never perfectly obey the user's command"
 - Tim Rogers

http://connorspuzzles.tumblr.com/

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: HTML5 Docs - I need your input
« Reply #5 on: December 27, 2011, 08:08:02 PM »
Funny thing about javascript. You don't need to declare types.

var myVar = 5;
var myVar2 = "cow';

Javascript is crazy like that, just so dynamic that is detects the type as the code runs...
So for simplicity sake I think I'll keep the same format:

var myVar = 5
var myVar2 = "cow"

x


  • GMG-er

  • **


  • Posts: 247
Re: HTML5 Docs - I need your input
« Reply #6 on: December 28, 2011, 04:14:05 AM »
Funny thing about javascript. You don't need to declare types.

var myVar = 5;
var myVar2 = "cow';

Javascript is crazy like that, just so dynamic that is detects the type as the code runs...
So for simplicity sake I think I'll keep the same format:

var myVar = 5
var myVar2 = "cow"

Welcome to the wonderful world of scripting languages.

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: HTML5 Docs - I need your input
« Reply #7 on: January 04, 2012, 10:04:53 AM »
Hey guys, I need a bit more input.

Here's my idea for handling multiple classes:

A new project starts with a Main class. Containing the General Methods such as Game Open, Key Down, Mouse Down, Ect. You can add custom methods to the Main class.

There's a drop down box right above the Methods bar. The drop down box is where you select your classes. You can make a new custom class. If you select the new custom class, it'll show 1 General Method: On Construct. That happens when you make a new object of that class. From there you can add custom methods to that class.


What do you guys think? Simple enough? Have a better way?

Circuit


  • GMG-er

  • **


  • Posts: 299

  • blast from the past
Re: HTML5 Docs - I need your input
« Reply #8 on: January 04, 2012, 01:57:59 PM »
Sounds good to me.  I'm curious to know how (or if) you plan to support inheritance.  A drop-down menu could show the relationships between superclasses and subclasses, but it would require some other widget or a group of widgets to create the relationship first.  I hope that makes sense.

GMG Kurt


  • GMG-er

  • **


  • Posts: 682

  • Sorry for being such a noob
Re: HTML5 Docs - I need your input
« Reply #9 on: January 04, 2012, 04:35:16 PM »
Funny thing about javascript. You don't need to declare types.

var myVar = 5;
var myVar2 = "cow';

Javascript is crazy like that, just so dynamic that is detects the type as the code runs...
So for simplicity sake I think I'll keep the same format:

var myVar = 5
var myVar2 = "cow"

Welcome to the wonderful world of scripting languages.

But can we declare types? Gan I enjoy being a memory whore, and if I can't whore my memory (wow that sounds horrible) then I can't be happy. I talking about the way C organizes it's data types, will we still be able to declare that way?
Just your average Weekend Warrior.
Yes I know I have bad spelling, it's what makes me such a good programmer!

"Old art, weather magnificent or wretched, is always the raw material of new art. The artist's job, though, is to

Connors


  • ^ This guy is amazing.

  • ****


  • Posts: 2374

  • It's a secret to everyone...
Re: HTML5 Docs - I need your input
« Reply #10 on: January 04, 2012, 05:22:58 PM »
I have yet to learn much about memory management...
Part of it has to to with making sure unused code isn't always loaded right? And unused variables?
Warning: The above post may have been modified multiple times.

"In a great game, the character must never perfectly obey the user's command"
 - Tim Rogers

http://connorspuzzles.tumblr.com/

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: HTML5 Docs - I need your input
« Reply #11 on: January 04, 2012, 05:26:58 PM »
Kurt:
Nope. From what I've experienced var is the only way.

Circuit:
Thanks for the input Circuit. I actually hadn't thought of inheritance. A drop down selection would be easiest... though inheritance can be created just by making 2 different class alike.

Hmm, this might make things more confusing for the end user. Turns out for Javascript classes you declare class specific variables by this.myVar = 2.
Which begs the question, should custom classes have a Class Variables section where you define variables by "var myVar"?
Or should I just allow the On Constuct method(or any other method in the class) to handle variables and you create variables by "this.myVar=2"? So for normal variables you use var, and for class variables you use this.myVar or myObject.myVar to declare.

Connors:
Yeah sorta something like that. Mostly based on references and pointers of objects, deallocating objects when not needed, ect.

Connors


  • ^ This guy is amazing.

  • ****


  • Posts: 2374

  • It's a secret to everyone...
Re: HTML5 Docs - I need your input
« Reply #12 on: January 04, 2012, 07:38:08 PM »
You mean local variables for classes? That would be good.
myObject.myVar or this.myVar makes sense.
Warning: The above post may have been modified multiple times.

"In a great game, the character must never perfectly obey the user's command"
 - Tim Rogers

http://connorspuzzles.tumblr.com/

Circuit


  • GMG-er

  • **


  • Posts: 299

  • blast from the past
Re: HTML5 Docs - I need your input
« Reply #13 on: January 07, 2012, 08:55:30 PM »
Circuit:
Thanks for the input Circuit. I actually hadn't thought of inheritance. A drop down selection would be easiest... though inheritance can be created just by making 2 different class alike.
Will it be possible to create an array of similar types and perform the same operations on all of them?  (Provided that they have the same variables and methods.)  If so, then that's fine.

Hmm, this might make things more confusing for the end user. Turns out for Javascript classes you declare class specific variables by this.myVar = 2.
Which begs the question, should custom classes have a Class Variables section where you define variables by "var myVar"?
Yes.  If Javascript requires class variables to have full names (e.g. this.myVar), then make the interpreter automatically prefix the class names onto the variables when the code is translated into Javascript.

Or should I just allow the On Constuct method(or any other method in the class) to handle variables and you create variables by "this.myVar=2"? So for normal variables you use var, and for class variables you use this.myVar or myObject.myVar to declare.
Constructors shouldn't create variables, only initialize them.  IMO.

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: HTML5 Docs - I need your input
« Reply #14 on: January 07, 2012, 09:02:14 PM »
Circuit:
Thanks for the input Circuit. I actually hadn't thought of inheritance. A drop down selection would be easiest... though inheritance can be created just by making 2 different class alike.
Will it be possible to create an array of similar types and perform the same operations on all of them?  (Provided that they have the same variables and methods.)  If so, then that's fine.

Hmm, this might make things more confusing for the end user. Turns out for Javascript classes you declare class specific variables by this.myVar = 2.
Which begs the question, should custom classes have a Class Variables section where you define variables by "var myVar"?
Yes.  If Javascript requires class variables to have full names (e.g. this.myVar), then make the interpreter automatically prefix the class names onto the variables when the code is translated into Javascript.

Or should I just allow the On Constuct method(or any other method in the class) to handle variables and you create variables by "this.myVar=2"? So for normal variables you use var, and for class variables you use this.myVar or myObject.myVar to declare.
Constructors shouldn't create variables, only initialize them.  IMO.
InJavascript you can declare class variables anywhere. The best place is in the constructor.