Main Menu

New Toy

Started by LemonWizard, May 13, 2011, 05:27:21 AM

Previous topic - Next topic

LemonWizard

My new toy, is this:



See pictures
First picture is, after: This is after coding.

Second picture is, Before: This was the design. Using paint, believe it or not ^_^
All my graphics were made in paint. Ahh good times.



The code, is a mess so I won't post it. YET. Oh man last time I said that my laptop failed on me the next night so the old project I had going has to be re coded from scratch, too bad I didn't post the code >.>


XD


so.. why not >.>

PlayBASIC Code: [Select]
SETFPS 60
openscreen 12*32, 11*32, 32, 1
current=1
dim enemies#(current, 3)
loadmusic("music.xm"), 1
loopmusic 1, on
playmusic 1

;This project is the official game, as a result of my Rapid Software Development System
;All credit goes to me including graphics, for now.

;some pallete help from tabu1121
;check out tabu1121 on newgrounds.com for great tracks!


;load the frames for the spike first

dim spikeframes(8)
for temp=1 to 8
spikeframes(temp)=loadnewfximage("Spike/Frame"+str$(temp)+".bmp")
next temp

;load the tiles

dim tiles(30) ;including springboard but we'll get to that
dim map(12, 11) ;make the map 12 tiles by 11 long
;load the tilesheet

tilesheet=loadnewfximage("GameSet1.bmp")
drawimage tilesheet, 0, 0, 0


tile=1


y=1
x=1

for count1=1 to 10
tiles(tile)=newfximage(32, 32)
getimage tiles(tile), (count1-1)*32, (y-1)*32, count1*32, y*32
tile=tile+1
next count1

y=2
for count2=1 to 10
tiles(tile)=newfximage(32, 32)
getimage tiles(tile), (count2-1)*32, (y-1)*32, count2*32, y*32
tile=tile+1
next count2

y=3

for count3=1 to 10
tiles(tile)=newfximage(32, 32)
getimage tiles(tile), (count3-1)*32, (y-1)*32, count3*32, y*32
tile=tile+1
next count3


rendertoscreen
cls

imagemaskcolour tiles(4), rgb(255, 255, 255)
imagemaskcolour tiles(5), rgb(255, 255, 255)

;okay now we have our tiles stored.
;next read the map file

for tempy=1 to 11
for tempx=1 to 12
map(tempx, tempy)=readdata()
next tempx
next tempy


enemies=get_enemies(1)

animtimer=timer()+500

do


if timer()>animtimer
mirrorimage tiles(4), 1, 0
mirrorimage tiles(5), 1, 0
animtimer=timer()+500
handle_enemies(enemies) ;the amount doesn't change within the level so this works here
endif




;draw the map





for tempy=1 to 11
for tempx=1 to 12



tile=map(tempx, tempy)


if tile>0
if tile<31
if tile<>4
if tile<>5
drawimage tiles(tile), (tempx-1)*32, (tempy-1)*32, 0
endif
endif
endif
endif


next tempx
next tempy


for temp=1 to enemies
num=enemies#(temp, 3)
if num>0

drawimage tiles(num), enemies#(temp, 1), enemies#(temp, 2),1
endif


next temp

sync
cls rgb(255, 255, 255)
loop


;sample map for level

data 11, 11, 11, 0, 0, 2, 0, 0, 0, 0, 0, 11
data 21, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 21
data 21, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0
data 21, 0, 0, 0, 0, 2, 0, 0, 5, 5, 5, 0
data 21, 0, 0, 0, 0, 2, 0, 2, 2, 2, 2, 11
data 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21
data 21, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 21
data 21, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0, 21
data 21, 0, 0, 0, 0, 2, 1, 2, 2, 2, 0, 2
data 21, 0, 5, 0, 0, 2, 0, 0, 4, 0, 16, 2
Login required to view complete source code


PHEW! Atleast I have a backup. Anyhow.
Also, there's a video here to:
http://www.youtube.com/watch?v=mVC8jQrhHWI





kevin


looks like a good start to something, but what exactly are we looking at ?

micky4fun

hi all

see yor new toy game is coming along , not easy just doing the gfx's by youself , but looks like you have done quite a good job using just paint
antoher good paint program that is free is paint.net can do quite a bit with that program , im just learning the basic stuff in that and its quite handy for doing overlays , layers

looking at the video , is it goint to be get from the start point to the exit and onto another litttle room type puzzle?

keep up the good work , it all takes time
mick :)

LemonWizard

#3
Trying to figure out how to have enemies moving free style, while still restricted to tile block limitations without using playbasic's map system. Hmmm...


PlayBASIC Code: [Select]
function handle_enemies(enemies)


for temp=1 to enemies

oldx=enemies#(temp, 1)
oldy=enemies#(temp, 2)
mapx=oldx/32
mapy=oldy/32


;movement

if mapy=<9
if mapx<=11
if mapx>1









if map(mapx, mapy+2)>0 ;is tile

move=rndrange(1, 2)

if mapx<9
if move=1
if map(mapx+1, mapy)=0
oldx=oldx+32
endif
endif
endif


if move=2
if map(mapx-1, mapy)=0
oldx=oldx-32
endif
endif

endif


if map(mapx, mapy+2)=0 ;isnt tile
oldy=oldy+16 ;make it fall
endif





endif ;make sure it doesn't go past the Y boundary
endif ;same with Y
endif





enemies#(temp, 1)=oldx
enemies#(temp, 2)=oldy

next temp



endfunction






This kind of isn't working.
Tiles that are 0 are not registered at all and count as "air" which means you fall. or enemies do.
The hardest part is making enemies restricted to a grid. I need somehow to know that enemies#(1, ,1 ) enemy 1's X/32=only an integer between 1-11
and that enemies#(1, 2) enemy 2's Y/32=only an integer between 1 and 12.

So I can ask map(x, y) which tile they are part of if any, map(X, Y+2) which tile is below it, and map(X+1, Y+2) which tile is below it and beside it.. etc.

help? Convert floating point into whole integer without decimals!

LemonWizard

Quote from: kevin on May 14, 2011, 02:33:17 AM

looks like a good start to something, but what exactly are we looking at ?


The idea::

We're looking at a 2d sidescrolling puzzle kind of game with some action. The sprites you see on screen are enemies, later I will convert the code to handle them as sprites but for now I'm just doddling around with graphics and this isn't even going to be what I build the game on but it is the sampler. Which lets me test graphically how it looks and style. ^_^ The concept is this, That green thing over there in the bottom right corner is actually a trampoline or bouncer of sort. If you get explosives, you can throw them onto the bouncer to reach far away obstacles such as walls and the like that can't normally be reached, and the bomb will be propelled, and then explode in mid air, opening the gap. Allowing the player to bounce off the bouncer, through the gap, into another area (maybe a secret area holding items undiscovered )

Enemies will be able to be hit from afar eventually, but the player starts with a hammer. And is able to whack enemies with it sending them flying across the stage, into walls.
Sometimes, if you hit an enemy hard enough it will smash against a wall and actually create dents or sometimes even remove the wall.

Some of the game's areas will be randomized dungeons at the start, in the interior but on the exterior it will be set. Basically once the game world is "Created' so to say, it will stay that way, but ONLY certain areas of the game world will be created at random, the rest will be designed, by hand. Since, it's sort of important to have that aspect in a good game you can't rely completely on random algorithms, unless you are very good at making them.

Recently::
I have been studying alot about games and gameplay mechanics and I figured out that I really need a more engaging game design to catch an audience so I'm seeing how long I can make this project last, My old hard drive got burnt out so I lost my motive for a while then I got very artistic so here I am! Long post I know. X_X

Goals::
I want to make something complete in playbasic that plays like a modern type game and is worth actually picking up to other users (Even those who don't program! :O) Also if I get good enough, I'm going to create an application/game that can track your programming skills and help keep track of how much you have improved. How often you program, etcetera. I might even turn it into like, a projects planning thing. Not sure yet... but I'm begining to realize that my skills aren't as limited as I thought, most of what holds me back is a creator's block, once I overcame that again it was like OMG I have to program these things.. hehe


Later on?:
I"m still going to make that mario project/demo game, But I so far have found it a lot more satisfying to make something unique and push myself so here I am doing just that! Some of the tile ideas were borrowed, from other designs but the art itself is only inspired by and not ripped from anything.



LemonWizard

#5
So this is it then. I feel like I have come a seriously long way in my quest to become good at making games!

I finally stepped into the realm of animation, though I'm still a newbie at this. So bear with me.
Ughhh.. after looking at dozens of mario sprites for days how could I not have figured out 2d animation BLECK

SO here a treat. This is probably the style of character I'm going to use in this game from now on. Enemies might remain the same. I'm not sure. It just came to me, my character that is. SO take a look!!






I'm sharing the source code in a .zip file on this site, and there IS a disclaimer in it. The graphical work is mine and so is the code. But if you ASK politely I might let you use them in a project of your own IF it's not something that will comprimise my project in the game market as in, you can't sell it. go ahead toy around though >.> no selling and no stealing of this work I spent hours on it and I am so very proud of it that I'd rather not have to worry about theft. not that any of YOU would steal my work ^_^ however I'm just saying.. in case.

So here's the first screenshot of the new character model in action. HOORAY!


Isn't it wonderful? I love it... so much.
Wait till you try the character movement out. I spent a few hours tweaking the physics, it's got gravity and basic back and forth movement, with a jump ability. Enjoy! (It's in a zip file, don't worry if you don't have playbasic I compiled it)

What's next::



The spring board of course, and making it work with the player, and working out the physics I want. YAY FOR FLOATING POINT NUMBERS.
:O gasp I'm even considering not using a map style system for my game but making levels more "Open"

>.< It'll be hard on my part since the collision will take serious work..oh well who knows. mechanics first, then game engine.


kevin

#6
   It's a good start, but there's a few issues.  There's some variables that probably aren't needed, but the main one is that the movement is machine dependent, as there's nothing to regulate the interval between frames.   So the movement speed is basically however fast the machine can run the main loop.     Which is a odd since you've using time to regulate animation speed but not the movement.   Which means it'll feel completely different on different systems.    

 ie.

PlayBASIC Code: [Select]
   // Read the controls a max of 40 times a second
TicksBetweenMovement=(1000/40)


MovementTime=Timer()

do
Cls
CurrentTime=Timer()

// Check if it's movement time ?
If CurrentTime>MovementTime

// check for right key
if rightKey()
Xpos+=2
endif

// check for left key
if leftKey()
Xpos-=2
endif

// Step forward the time of next movement
MovementTime=MovementTime+TicksBetweenMovement
endif

print Fps()

Circle Xpos,100,50,true

Sync
loop


 

 You really should be limiting the app from hogging the system though, which is what this type of loop is doing.   Capping it 100/200 fps more than  enough.