Author Topic: jBasic  (Read 28382 times)

0 Members and 1 Guest are viewing this topic.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: jBasic
« Reply #30 on: May 01, 2010, 07:37:19 pm »
aaaah ok ^^, I'll try later I guess. I hope you write some tutorials that comes with this later ^^
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6265
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
Re: jBasic
« Reply #31 on: May 01, 2010, 11:07:52 pm »
Yeah I intend to write some tutorials :) hopefully they will help :)

Now to figure out how to get multiple keypresses.
/e

Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6265
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
Re: jBasic
« Reply #32 on: May 04, 2010, 04:27:49 pm »
ok, I've been making some progress on jBasic, so far I have just added some support for getting and setting the x and y position of objects, so this will make it easier to move stuff on the screen. It's hard to make an object orientated language work like TI-Basic, so there will be some differences, mainly, it's still object orientated. I'll probably be adding more object manipulators, like something that checks if it is still within the screen, etc.
For the Key's I have text identifier support for the arrow keys, shift, ctrl, alt, pause/break and enter, any more I should make easily accessible? Keep in mind I still have the Key-codes so you can check for all the keys :P Multiple key-presses are still not supported, but I will be adding them possibly soon.

New Template:
Code: [Select]
<html>
 <head>
  <title>
   Title
  </title>
  <script type="text/javascript" src="jBasic.js"></script>
  <script type="text/javascript">
   function setup(){
    //put code here
   }
  </script>
 </head>
 <body onload="gScreen = document.getElementById('window');setup();" >
  <div id="window" >
  </div>
  <form name="keyform">
   <input id="getkey" style="visibility:hidden;" readonly="readonly" type="text" value=""></input>
   <input id="getkeycode" style="visibility:hidden;" readonly="readonly" type="text" value=""></input>
  </form>
 </body>
</html>
« Last Edit: May 04, 2010, 04:42:38 pm by Eeems »
/e

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: jBasic
« Reply #33 on: May 04, 2010, 04:43:22 pm »
is the language mostly meant for game development? If so, I guess not too many keys might be needed. Just some easy to reach ones with fingers for general 2D games
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline Galandros

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1140
  • Rating: +42/-10
    • View Profile
Re: jBasic
« Reply #34 on: May 04, 2010, 04:50:32 pm »
I wonder, in Javascript, are there any possibility of interaction from the user by pressing keys? Otherwise I guess a point and click game could be awesome too when it has more commands
Yes, gladly you can get mouse and keyboard input. I think it is not very cross-browser so it requires some code for each browser.
Hobbing in calculator projects.

Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6265
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
Re: jBasic
« Reply #35 on: May 04, 2010, 04:50:41 pm »
yes, this will be meant for game development, so which key's would you want?
/e

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: jBasic
« Reply #36 on: May 04, 2010, 04:57:07 pm »
Shift, Z, X and C might be good. A lot of PC games use those for platformers, especially Game Maker games. Else, some games use SPACEBAR for jumping.
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6265
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
Re: jBasic
« Reply #37 on: May 04, 2010, 05:22:44 pm »
yeah..well I got multiple keypresses working, but now I can't support the way I had it before, so:
http://www.webonweboff.com/tips/js/event_key_codes.aspx keycodes are here, and the new format for getKey() is:

getKey(e)
returns true if the key is pressed and false if it is not

e =  the keycode you are checking for
/e

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: jBasic
« Reply #38 on: May 04, 2010, 05:25:25 pm »
seems like I might go with shift and the nearby keys then. Idk if I feel like using pageup/down or the like since both my hands would be on top of each others while playing x.x

Btw I like how getkey looks like axe
« Last Edit: May 04, 2010, 05:25:48 pm by DJ Omnimaga »
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6265
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
Re: jBasic
« Reply #39 on: May 04, 2010, 11:18:26 pm »
Thanks :) yeah, its the best way to use it :p
I'll try to add string based testing later for the more used keys, but its not a priorety.
/e

Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6265
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
Re: jBasic
« Reply #40 on: May 05, 2010, 08:19:44 pm »
ok, I've added a keySim() command for all of those who want to give the users out there without a proper keyboard a way of using it :P

keySim(key);
simulates a key-press. key is down for 100 milliseconds, then the key is "released".

key = the key-code of the key pressed

EDIT: added objLocWidth() objLocHeight() and objCheck(). they are untested though, so I don't know if they work.

objLocHeight(obj);
returns the y location of the bottom of the object
obj = the pointer to the object

objLocWidth(obj);
returns the x location of the right side of the object
obj = the pointer to the object

objCheck(obj);
checks to see if the object is within the window
obj = the pointer to the obj
« Last Edit: May 05, 2010, 08:28:56 pm by Eeems »
/e

Offline Galandros

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1140
  • Rating: +42/-10
    • View Profile
Re: jBasic
« Reply #41 on: May 06, 2010, 04:42:33 pm »
Keys for JavaScript:
Shift, Ctrl, Space,
arrows keys, W,A,S,D,
Q,W,E,R,A,S,D,F,Z,X,C,V

This is my choice having in count usual games and emulators.
Hobbing in calculator projects.

Offline ztrumpet

  • The Rarely Active One
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 5712
  • Rating: +364/-4
  • If you see this, send me a PM. Just for fun.
    • View Profile
Re: jBasic
« Reply #42 on: May 06, 2010, 04:49:35 pm »
This is a neat project Eeems!  ;D
Good luck with this! :D

Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6265
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
Re: jBasic
« Reply #43 on: May 06, 2010, 05:11:58 pm »
Thanks!
I'll be making some more progress later on today as i have time to work on it.
/e

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: jBasic
« Reply #44 on: May 06, 2010, 07:48:41 pm »
keep up the good work!
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)