Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 10-08-2008, 01:14 AM   PM User | #1
cgwalls
New to the CF scene

 
Join Date: Sep 2008
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
cgwalls is an unknown quantity at this point
Are views and levels possible with JavaScript?

I was just kind of curious if it would be possible to make views with javascript. Say you wanted to make a game kind of like mario how would you make it so it scrolls with the object as you move throught the room? Also i was wondering how you would load the next level when you finish the one you are on?

thank you,
cgwalls
cgwalls is offline   Reply With Quote
Old 10-08-2008, 03:00 AM   PM User | #2
liorean
The thread killer


 
Join Date: Feb 2003
Location: Umeå, Sweden
Posts: 5,575
Thanks: 0
Thanked 84 Times in 75 Posts
liorean will become famous soon enoughliorean will become famous soon enough
Entirely possible, through various ways. You can animate pretty much through the canvas element, VML or SVG - you could even generate HTML or actual graphics (BMP are simple to generate but not so small in memory, as an example). You can load levels through creating script elements that load JavaScript code for the next level, or you can use XMLHttpRequest, or you can use a form (making each level a separate HTML page) etc. The technique you use for the graphics part is pretty much the same as for desktop or Flash games, only a few years behind in technology level.
__________________
liorean <[lio@wg]>
Articles: RegEx evolt wsabstract , Named Arguments
Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards
liorean is offline   Reply With Quote
Old 10-11-2008, 03:33 AM   PM User | #3
cgwalls
New to the CF scene

 
Join Date: Sep 2008
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
cgwalls is an unknown quantity at this point
ok so i kind of get how to load the levels but i'm not really quite sure how to get the level to scroll as you move through it. i was thinking you would make a variable go up every time you move and check if the variable is at a certain number to move the background or something. but then if there were enemies farther in the level how would i get those to appear when i get far enough in the room. i'm really confused lol.
cgwalls is offline   Reply With Quote
Old 10-11-2008, 01:40 PM   PM User | #4
A1ien51
Senior Coder

 
A1ien51's Avatar
 
Join Date: Jun 2002
Location: Between DC and Baltimore In a Cave
Posts: 2,717
Thanks: 1
Thanked 94 Times in 88 Posts
A1ien51 will become famous soon enough
It is called learning how to program and thinking how things work.

You set up conditions. If player is in X1 area, I do this. If player is in X2 area I do this.

If I were you, I would worry less about enemies at this time and get a character moving through some screen.

Here is an example for you to start out with: http://ajaxpatterns.org/wiki/index.p...rite#Solutions

Eric
__________________
Tech Author [Ajax In Action, JavaScript: Visual Blueprint]
A1ien51 is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:01 AM.


Advertisement
Log in to turn off these ads.