Topic:   V6 Engine   (Read 24743 times)


0 Members and 1 Guest are viewing this topic.

Silverwind


  • ^ This guy is amazing.

  • ****


  • Posts: 2805

  • For the glory of my maker
Re: V6 Engine
« Reply #15 on: June 23, 2008, 02:18:38 PM »
Quote
Thanks, is anything in this script on a timer?
Nope. The NPC script (which isn't included) can run on a timer or keydown with minimal difference in code. It'll be included when I release the demo engine.

Quote
I'm a little confused by a certain part of the script. It says, LET playerY = gridY * 44 but gridY isn't defined as a variable yet. So how does that work?
That variable needs to be set before entering a card. Here's a few of the variables I set in the New Adventure button in QoM for example:
Code: [Select]
gridY = 4
gridX = 4
moveY = gridY
moveX = gridX
playerY = 137
playerX = 137

NPCspeed = 50
NPCgridY = 4
NPCgridX = 4
NPCspriteY = 137
NPCspriteX = 137

moveup$ = "moveup "
movedown$ = "movedown "
moveleft$ = "moveleft "
moveright$ = "moveright "
Quote
And also, if you could explain what each section of code is suppose to do, that will help a lot.) :)
I'll do that when I release the demo engine. I doubt I'll be releasing it anytime soon though with all of these projects. Here's a quick rundown:

Code: [Select]
LET gridlayout$ = ""  
LET northcard = 0  
LET southcard = 0  
LET eastcard = 0  
LET westcard = 0  
LET playerY = gridY * 44  
LET playerY = playerY - 39  
LET playerX = gridX * 44  
LET playerX = playerX - 39  
LET moveY = gridY  
LET moveX = gridX
 
Sets the computer's bearings so that it knows what cards are North, South, East and West of the current card. Then positions the player sprite according to the GridX and GridY variables.

Code: [Select]
'----PLAYER CODE--------------------------------------------------------------------  ------------   
ON KEYDOWN  
LET newtile$ = "empty"  
IF keydown$ = "UPARROW" THEN
LET moveY = gridY - 1  
END IF
IF keydown$ = "DOWNARROW" THEN
LET moveY = gridY + 1  
END IF
IF keydown$ = "LEFTARROW" THEN
LET moveX = gridX - 1  
END IF
IF keydown$ = "RIGHTARROW" THEN
LET moveX = gridX + 1  
END IF
'----GRID CODE--------------------------------------------------------------------  ---------------
Detects which arrow button the player presses, so that the computer knows which way to attempt to move the player in.

Code: [Select]
LET moveXY = 0  
LET moveXY = 7 * moveY  
LET moveXY = moveXY - 7  
LET moveXY = moveXY + moveX  
LET newtile$ = MID$(gridlayout$, moveXY, 1)
The core of the engine. This is the magic that makes collision happen. Limitless collision classes... massive storage space... oh yeah...

Code: [Select]
IF newtile$ = "0" THEN
 LET newtile$ = "empty"  
END IF
IF newtile$ = "1" THEN
LET newtile$ = "wall"  
END IF
IF newtile$ = "2" THEN
LET newtile$ = "portal 1"  
END IF
Determines which collision class the space the player is trying to move onto is.

Code: [Select]
IF moveY < 1 THEN  
 Â LET gridY = 7  
 Â GOTOCARD northcard  
END IF  
IF moveY > 7 THEN  
 Â LET gridY = 1  
 Â GOTOCARD southcard  
END IF  
IF moveX > 7 THEN  
 Â LET gridX = 1  
 Â GOTOCARD eastcard  
END IF  
IF moveX < 1 THEN  
 Â LET gridX = 7  
 Â GOTOCARD westcard  
END IF  
IF newtile$ = "portal 1" THEN  
 Â LET gridY = 0  
 Â LET gridX = 0  
 Â GOTOCARD 0  
END IF
IF newtile$ = "empty" THEN  
 Â IF keydown$ = "UPARROW" THEN
LET playerY = playerY - 44  
END IF
 Â IF keydown$ = "DOWNARROW" THEN
LET playerY = playerY + 44  
END IF
 Â IF keydown$ = "LEFTARROW" THEN
LET playerX = playerX - 44  
END IF
 Â IF keydown$ = "RIGHTARROW" THEN
LET playerX = playerX + 44  
END IF
 Â LET gridY = moveY  
 Â LET gridX = moveX  
END IF  
IF newtile$ = "wall" THEN  
 Â LET moveY = gridY  
 Â LET moveX = gridX  
END IF
References the properties of collision classes.
I survived the spammage of 2007

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: V6 Engine
« Reply #16 on: June 23, 2008, 06:52:15 PM »
nvm.


-Gandolf
« Last Edit: June 23, 2008, 07:05:15 PM by Gandolf »

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: V6 Engine
« Reply #17 on: June 23, 2008, 07:08:24 PM »
Hah! I did it! I converted the v6 Engine to Sc successfully! It works perfectly. :D

Here is a link: http://www.mediafire.com/?wwgmm3mxshd

Sc doesn't have the word command so I substituted it with NTHFIELD.

Sc can now make v6 games.


-Gandolf
« Last Edit: June 24, 2008, 09:24:38 AM by Gandolf »

Swamp7hing


  • GMG-er

  • **


  • Posts: 751

  • I come from the swamps.
Re: V6 Engine
« Reply #18 on: June 24, 2008, 08:48:40 AM »
Quote
Hah! I did it! I converted the v6 Engine to Gm successfully! It works perfectly. :D

Here is a link: http://www.mediafire.com/?wwgmm3mxshd

Sc doesn't have the word command so I substituted it with NTHFIELD.

Sc can now make v6 games.


-Gandolf

You do mean I converted it to SC, right? :D

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: V6 Engine
« Reply #19 on: June 24, 2008, 09:24:18 AM »
Haha, Sorry  ;D


-Gandolf

Tireas Dragon


  • GMG Extraordinaire

  • ***


  • Posts: 1626

  • Trying to recover from my shattered screen.
Re: V6 Engine
« Reply #20 on: June 24, 2008, 11:05:42 PM »
Ya it kinda confused me too.

I must be dreaming (wake up me wake up) How could this have happened. Tireas' cry when he found his computer fallen over in his chair with it's screen shattered.

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: V6 Engine
« Reply #21 on: June 25, 2008, 09:02:21 AM »
I'm thinking. How would we change the grid system to support 30 pixel tiles instead of 44 pixel?


-Gandolf

HarryCaray


  • GMG-er

  • **


  • Posts: 119

  • I love YaBB 1G - SP1!
Re: V6 Engine
« Reply #22 on: June 25, 2008, 12:59:48 PM »
Quote
I'm thinking. How would we change the grid system to support 30 pixel tiles instead of 44 pixel?


-Gandolf

Instead of pushing the sprite 44 pixels push it 30? Then redraw your map to support 30x30 tiles?

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: V6 Engine
« Reply #23 on: June 25, 2008, 03:30:14 PM »
:D I did it. I have much more move space too. From 49 tiles on the map to 81.

-Gandolf

Silverwind


  • ^ This guy is amazing.

  • ****


  • Posts: 2805

  • For the glory of my maker
Re: V6 Engine
« Reply #24 on: June 25, 2008, 04:43:28 PM »
Quote

Instead of pushing the sprite 44 pixels push it 30? Then redraw your map to support 30x30 tiles?
Yeah, it's fairly straightforward. You'd have to change the core as well:

Code: [Select]
LET moveXY = 0   
LET moveXY = 7 * moveY  
LET moveXY = moveXY - 7  
LET moveXY = moveXY + moveX  
LET newtile$ = MID$(gridlayout$, moveXY, 1)

Would become:

Code: [Select]
LET moveXY = 0   
LET moveXY = 9 * moveY  
LET moveXY = moveXY - 9  
LET moveXY = moveXY + moveX  
LET newtile$ = MID$(gridlayout$, moveXY, 1)
I survived the spammage of 2007

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: V6 Engine
« Reply #25 on: June 25, 2008, 06:28:50 PM »
Do, you think it would be hard to make a direction block?

Like, lets say you have a tree that is in the middle of two squares. Could you have it so you could walk on one of the squares the tree is on but not be able to go through the tree to the next square the tree is on?

So if you're on a certain square, you cannot go a certain direction.


-Gandolf

Tireas Dragon


  • GMG Extraordinaire

  • ***


  • Posts: 1626

  • Trying to recover from my shattered screen.
Re: V6 Engine
« Reply #26 on: June 25, 2008, 11:46:18 PM »
Ya you make a special tile so that if you try to move on a certain direction on that special tile it doesn't work.
Example:
y = 9 * ManV
y = y - 9
y = y + ManH
x$ = MID$ gridlayout$ y 1
ON KEYDOWN
  IF keydown$ = "RIGHTARROW" THEN
    IF x$ <> "a" THEN
     do move
    END IF
  END IF
END IF
I must be dreaming (wake up me wake up) How could this have happened. Tireas' cry when he found his computer fallen over in his chair with it's screen shattered.

Gan


  • Administrator

  • ^ This guy is amazing.

  • *****


  • Posts: 4411
Re: V6 Engine
« Reply #27 on: June 25, 2008, 11:54:43 PM »
Thanks.  ;)

I'm going to look more into this.


-Gandolf

Silverwind


  • ^ This guy is amazing.

  • ****


  • Posts: 2805

  • For the glory of my maker
Re: V6 Engine
« Reply #28 on: June 26, 2008, 12:31:54 AM »
Quote
y = 9 * ManV
y = y - 9
y = y + ManH
x$ = MID$ gridlayout$ y 1
ON KEYDOWN
 Â IF keydown$ = "RIGHTARROW" THEN
 Â   IF x$ <> "a" THEN
 Â    do move
 Â   END IF
 Â END IF
END IF
Um... yeah, I suppose... but why not just make a collision class? That's what V6 is all about:

Code: [Select]
IF newtile$ = "left side wall" THEN
  LET newtile$ = "empty"
  IF keydown$ = "RIGHT ARROW" THEN LET newtile$ = "wall"
END IF
I survived the spammage of 2007

Tireas Dragon


  • GMG Extraordinaire

  • ***


  • Posts: 1626

  • Trying to recover from my shattered screen.
Re: V6 Engine
« Reply #29 on: June 26, 2008, 01:04:01 AM »
That works too.

I must be dreaming (wake up me wake up) How could this have happened. Tireas' cry when he found his computer fallen over in his chair with it's screen shattered.