News:

PlayBASIC2DLL V0.99 Revision I Commercial Edition released! - Convert PlayBASIC programs to super fast Machine Code. 

Main Menu

Go Go Go! Demo. Playable.

Started by LemonWizard, April 30, 2013, 07:38:44 PM

Previous topic - Next topic

LemonWizard

hey everyone, I know it's been a while since I've even had a post in here or something worth posting in here.
Life's been super busy. :D

I made something awesome today (well I think it's awesome) and I'm going to share it with you.
It's going to be a multiplayer game sometime soon.
So it's going to use MultiSync later.

For now it's single player demo.
Here's screenshots for you, and a working demo as an attachment.
The code is posted below to.

PlayBASIC Code: [Select]
; PROJECT : Go_Go_Go
; AUTHOR : LemonWizard
; CREATED : 4/30/2013
; EDITED : 4/30/2013
; ---------------------------------------------------------------------


//This project is a test project and not yet complete yet
//All of the art and code in this project are mine.
//you may not re use any of the resources included within this project without my personal consent
//if you wish to help me with this project you can email me or pm me on the forums.

// EMAIL ADDRESSES REMOVE- DOWNLOAD ATTACHMENT FOR FULL CODE

///Thank you all and enjoy this simple but fun demo!



camera=off



openscreen 1024, 768, 32, 1
amountofsolidsx=getscreenwidth()/16
amountofsolidsy=getscreenheight()/16


//use space key at start of menu screen to actually start
//you can use the enter key in order to change camera modes, currently can not be changed back.
//you can use the right mouse button to reposition your character if it falls.



dim solids(amountofsolidsx, amountofsolidsy)
#include "multisync"
titlescreen "Go Go Go! (Development Mode)"

//check for tile data here

if fileexist("/collision_data.txt")
readfile "/collision_data.txt", 2

for tempx=1 to amountofsolidsx
for tempy=1 to amountofsolidsy
solids(tempx, tempy)=readint(2)
next tempy
next tempx
closefile 2 //we want to close it now

endif //only try to load tile data if file exists

screen1=loadnewfximage("Thatartthere.png")
cursor=loadnewfximage("cursor.png")
menu=loadnewfximage("menu.png")
character1=loadnewfximage("character_1.png")
multistage=loadnewfximage("Multi_level1.png")


imagemaskcolour cursor, rgb(255, 255, 255)
imagemaskcolour character1, rgb(255, 255, 255)

cursory=330
cursorx=115


character=newsprite(0, 0, character1)
autocenterspritehandle character, true

spritedrawmode character, 02


mainmenu:



drawimage screen1, 0, 0, 0

drawimage menu, 100, 300, 0

drawimage cursor, cursorx, cursory+cursor, 1

if downkey()
cursory=cursory+16
endif

if cursory>420 then cursory=420

if upkey()
cursory=cursory-16
endif

if cursory<330 then cursory=330


sync
cls rgb(0,0,0)

if spacekey()
char1falling=true
stage_screen=newfximage(1024, 768)
camimage=newfximage(400, 400)
screenimage=newfximage(400, 400)
goto multiplaydemo

endif


goto mainmenu



multiplaydemo:

if camera=on
rendertoimage stage_screen
endif


char1falling=true //set the falling value to true before we do any checking



drawimage multistage, 0, 0, 0


//drawimage character1, char1x, char1y, 1

rotatesprite character, 360-char1jumptime

positionsprite character, char1x+82/2, char1y+85/2

drawallsprites


if leftmousebutton()

for tempx=1 to amountofsolidsx
for tempy=1 to amountofsolidsy

select solids(tempx, tempy)
case 1
box (tempx-1)*16, (tempy-1)*16, tempx*16, tempy*16, 0
case 2
box (tempx-1)*16, (tempy-1)*16, tempx*16, tempy*16, 1
endselect


if mouseinbox((tempx-1)*16, (tempy-1)*16, tempx*16, tempy*16)
solids(tempx, tempy)=1
Login required to view complete source code



By the way an update! URGENT UPDATE: The collision data did not transfer in the upload.
If you want to try out the platforms thing, you have to place the solid blocks yourself. You can do this by using the left mouse button anywhere on the screen. It's pretty simple. :D



Mod Edit: Contact details remove the code block, download the attachment for those.


BlinkOk

it's a good start lemony dude.
my dude kept falling off even though i had placed tiles there. it seems whenever the tiles are placed to make a hill going up hell fall off.
btw: you right click to drop the player dude (just so people know)

LemonWizard

#2
Thanks BlinkOK :D

In case no one read the comments in the code, once you'ved placed your collision tiles.
You can actually hit the enter key to get a zoomed camera effect.
It slows it down a bit, I don't know how to speed that up. To a playable... speed.
Maybe kevin would like to help with that one? :)I wanted to do something similiar to how the camera
in smash bros works.