Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - xxbastianxx

Pages: [1] 2 3
1
Bug Reports / Re: Jump and Run Errors
« on: 2013-Mar-14 »
Thank You lots!!!

It works :) YAY* Just a little problems with starting.

Thank you sooo much!

2
Bug Reports / Re: Jump and Run Errors
« on: 2013-Mar-14 »
Updated only 2 Mistakes now

3
Bug Reports / Re: Jump and Run Errors
« on: 2013-Mar-14 »
I fixed the one with the TurnImage... the function was missing

But I cant find the other ones.

Can i post you my code like it is now and could you please have a look ?

That would be awesome!

4
Bug Reports / Re: Jump and Run Errors
« on: 2013-Mar-14 »
I've fixed all i could but there are still some mistakes, which I dont understand since the compiler gives me "FATAL ERROR"  :giveup:

Could somebody help me fix them ? Please.  :-[


C:\Users\SEBAST~1\AppData\Local\Temp\glbasic\gpc_temp0.cpp: In function `int __GLBASIC__::__MainGameSub_()':
C:\Users\SEBAST~1\AppData\Local\Temp\glbasic\gpc_temp0.cpp:505: error: a function-definition is not allowed here before '{' token


By now only the last 2 mistakes are not found yet. :(
It's keeping me up...

I've checked the WEND's/ENDIF's... they r all there.

5
Bug Reports / Re: Jump and Run Errors
« on: 2013-Mar-14 »
Ok, thank you. I ll try and fix that ;)

6
Bug Reports / Re: DDgui.gbas (1168) Error
« on: 2013-Mar-14 »
I put the Data in a Zip File...

7
Bug Reports / Re: DDgui.gbas (1168) Error
« on: 2013-Mar-14 »
Yes, I can...

What I just did now is Copy all the Codes and Datas that I use and I put them in the right order in a new Project. Now it seem to work, since the Compiler passes Map. etc. and is telling me about syntax error, which makes me happy, because those are only ", or =" i forgot xD

To that: The Compiler tells me that "x = INTEGER" is a Syntax error... I don't get that ! o.O

I ll load all my data.

Thank You very much for all your help so far! <3

8
Bug Reports / Re: DDgui.gbas (1168) Error
« on: 2013-Mar-14 »
The byte file in the media file, is empty! I just found that out... now i copied the map0.txt map in there and now GL Basic gives me a Syntax error... I can't find the mistake... :/

Can somebody please help ?

9
Bug Reports / Re: DDgui.gbas (1168) Error
« on: 2013-Mar-14 »
My Media File:

The Map0 data is marked

10
Bug Reports / Re: DDgui.gbas (1168) Error
« on: 2013-Mar-14 »
Thank You for the asnwer.

But the file map0.map is in the media file. It's wierd, because I used a .txt file (TextEditor from Windows) to create this map and saved it as map0.txt, then i went in to GL Basic and opened map0.txt and as i saved it was saved as byte file. I'll make a screenshot of my media file...

11
Bug Reports / Re: DDgui.gbas (1168) Error
« on: 2013-Mar-12 »
I've got another problem:

The first "Map. .... " the Compiler finds gives back an error: wrong argument type: TYPE TMap is not declared.


E.G.: Map.NextMap$ = DDgui_get$("nextmap", "TEXT")

Thats what the compiler did before as well...

this "Map. bla bla bla" ist what tells the program specificaly where and what to do, isn't it ?
Maybe in the newer versions of GL Baisc you dont need this extra "Map. ... " ? !

Can you help me ?



12
Bug Reports / Re: DDgui.gbas (1168) Error
« on: 2013-Mar-12 »
ahhh ;) TY

13
Bug Reports / Re: DDgui.gbas (1168) Error
« on: 2013-Mar-10 »



After compiling it says :

"DDgui.gbas"(1168) error : redefinition as different type : height is of type DGInt
"My Jump and Run.gbas"(230) : GLOBAL definition here



Main:

Code: (glbasic) [Select]


SETCURRENTDIR("Media") // go to media files

CONSTANT STATE_IS_GAME = 0
CONSTANT STATE_IS_EDIT = 1

GLOBAL Gamestate% = STATE_IS_EDIT
GLOBAL EditorEnemy AS TEnemy
GLOBAL SelectTile% = 0
GLOBAL MouseX, MouseY, ML, MR

GLOBAL BGImage%
BGImage = GENSPRITE()
LOADSPRITE "bg.png", BGImage

GLOBAL PlayerImage%
PlayerImage = GENSPRITE()
LOADANIM "Player.png", PlayerImage, 16, 64

GLOBAL LeiterImage%
LeiterImage = GENSPRITE()
LOADSPRITE "Leiter.png", LeiterImage

GLOBAL HerzImage%
HerzImage = GENSPRITE()
LOADSPRITE "Herz.png", HerzImage


GLOBAL SpikeImage%
SpikeImage = GENSPRITE()
LOADSPRITE "Spike.png", HerzImage

GLOBAL TrampolinImage%
TrampolinImage = GENSPRITE()
LOADSPRITE "Trampolin.png" , TrampolinImage

GLOBAL PigImage%
PigImage = GENSPRITE()
LOADANIM "Pig.png" , PigImage, 32, 64

GLOBAL BossImage%
BossImage = GENSPRITE()
LOADSPRITE "Boss.png", BossImage

GLOBAL BirdImage%
BirdImage = GENSPRITE()
LOADANIM "Bird.png", BirdImage, 32, 16

GLOBAL DoorImage%
DoorImage = GENSPRITE()
LOADSPRITE "Tür.png", DoorImage



GLOBAL Player AS TPlayer //Spieler erstellen
GLOBAL Map AS TMap //Map erstellen


GOSUB Init
WHILE TRUE


   GOSUB Render
   GOSUB Update


   SHOWSCREEN
WEND


SUB Update:

SELECT Gamestate%
CASE STATE_IS_GAME
FOREACH Enemy IN Enemys[]
Enemy.Update()
NEXT
Player.Update()
CASE STATE_IS_EDIT

MOUSESTATE MouseX, MouseY, ML, MR

SELECT TRUE
CASE DDgui_get("tilepicker", "CLICKED")
SELECT DDgui_getitemtext$("tilepicker", DDgui_get("tilepicker", "SELECT"))


CASE "Leer"
SelectTile = 0
CASE "Solide"
SelectTile = 1
CASE "Trampolin"
SelectTile = 5
CASE "Stachel"
SelectTile = 3
CASE "Leiter"
SelectTile = 2
CASE "Schwein"
SelectTile = 6
EditorEnemy.Init(IS_PIG, 0, 0)
CASE "Vogel"
SelectTile = 8
EditorEnemy.Init(IS_BIRD, 0, 0)
CASE "Boss"
SelectTile = 7
EditorEnemy.Init(IS_BOSS, 0, 0)
CASE "Teleport"
SelectTile = 10

ENDSELECT
ENDSELECT


IF BOXCOLL (DDgui_get("", "XPOS"), DDgui_get("", "YPOS"), DDgui_get("", "WIDTH"), DDgui_get("", "HEIGHT"), MouseX, MouseY, 1, 1) = FALSE
LOCAL x = INTEGER((MouseX - Map.ScrollX)/Tilesize)
LOCAL y = INTEGER((MouseY - Map.ScrollY)/Tilesize)

IF ML AND x >= 0 AND y >= 0 AND x < Map.width AND y < Map.height

IF IsEnemy()
LOCAL enem AS TEnemy
enem = EditorEnemy
DIMPUSH Enemys[], enem
ELSE
Map.Datas[x][y] = SelectTile
ENDIF
ENDIF
ENDIF


ENDSELECT
ENDSUB

SUB Render:
LOCAL width, height
GETSCREENSIZE width, height
STRETCHSPRITE BGImage, 0,0, width, height

SELECT Gamestate%
CASE STATE_IS_GAME



FOREACH Enemy IN Enemys[]
Enemy.Render()
NEXT

    Player.Render()
    CASE STATE_IS_EDIT
    FOR x = 0 TO Map.width*Tilesize STEP Tilesize
    DRAWLINE x + Map.ScrollX, 0 + Map.ScrollX, x + Map.ScrollX, Map.height*Tilesize + Map.ScrollX, RGB (255,255,255)
    NEXT

    FOR y = 0 TO Map.height*Tilesize STEP Tilesize
    DRAWLINE 0 + Map.ScrollY, y + Map.ScrollY, Map.width*Tilesize + Map.ScrollY, y + Map.ScrollY, RGB (255,255,255)
    NEXT


    INC Map.ScrollX, (KEY(203) - KEY (205))*4
    INC Map.ScrollY, (KEY(203) - KEY (208))*4



    Map.Render ()
   
    FOREACH Enemy IN Enemys[]
Enemy.Render()
NEXT

LOCAL x = INTEGER((MouseX - Map.ScrollX)/Tilesize)
LOCAL y = INTEGER((MouseY - Map.ScrollY)/Tilesize)

    IF IsEnemy()
    EditorEnemy.x = x*Tilesize
    EditorEnemy.y = y*Tilesize
    EditorEnemy.Render()
    ELSE
    Map.RenderTile(SelectTile, x, y)
    ENDIF
    DDgui_show(FALSE)
    ENDSELECT
ENDSUB


SUB Init:
LOADFONT "font.png", 1
SELECT Gamestate
CASE STATE_IS_GAME
Player.Init (100,100)
Map.Init("map0.txt")
CASE STATE_IS_EDIT
DDgui_init()

DDgui_pushdialog(width -140, 0, 140, height)

GOSUB CreateMap





DDgui_framestart("", "Tile Auswaehlen:")
DDgui_list("tilepicker", "Leer|Solide|Trampolin|Leiter|Stachel|Schwein|Vogel|Boss|Teleporter", 130, 200)
DDgui_frameend()

DDgui_framestart("", "Naechste Map:")
DDgui_text("nextmap", "", 120, 0)
DDgui_frameend()
ENDSELECT



ENDSUB



SUB CreateMap:
LOCAL width, height
GETSCREENSIZE width, height


DDgui_pushdialog(0,0,width, height)
DDgui_framestart("", "Breite")
DDgui_widget("", "Breite:")
DDgui_text ("breitetext", 20)
DDgui_slider("breiteslide", 20, width/3*2)
DDgui_set("breiteslide", "MINVAL", 10)
DDgui_set("breiteslide", "MAXVAL", 160)

DDgui_set("breiteslide", "STEP", 1)
DDgui_automate("breiteslide", "TEXT", "breitetext", "TEXT")
DDgui_frameend()

DDgui_framestart("", "Hoehe")
DDgui_text ("hoehetext", 20)
DDgui_slider("hoeheslide", 20, width/3*2)
DDgui_set("hoeheslide", "MINVAL", 10)
DDgui_set("hoeheslide", "MAXVAL", 160)
DDgui_set("hoeheslide", "STEP", 1)
DDgui_automate("hoeheslide", "TEXT", "breitetext", "TEXT")
DDgui_frameend()


DDgui_framestart("", "Tileset")
DDgui_combo("tileset", "tileset1.png", width/3*2)
DDgui_frameend()

DDgui_spacer()

DDgui_framestart("", "Aktion")
DDgui_button("erstellen" , "Erstellen")
DDgui_button("abbrechen" , "Abbrechen")
DDgui_frameend()




WHILE TRUE

SELECT TRUE
CASE DDgui_get("erstellen" , "CLICKED")
Map.InitEmpty(DDgui_get("breiteslide", "TEXT"), DDgui_get("hoeheslide", "TEXT"), DDgui_get$("tileset", "TEXT"))
BREAK
CASE DDgui_get("abbrechen" , "CLICKED")
END
ENDSELECT

DDgui_show(TRUE)
SHOWSCREEN
WEND

DDgui_popdialog()

ENDSUB


FUNCTION IsEnemy%: t

IF SelectTile = 6 OR SelectTile = 7 OR SelectTile = 8
RETURN TRUE
ELSE
RETURN FALSE
ENDIF

ENDFUNCTION



Player:

Code: (glbasic) [Select]

//Spieler

TYPE TPlayer

x; y
vx; vy //Vektor x,y
width%
height%
Anim%
HP%
ScrollX; ScrollY
Enemy%

//...

FUNCTION Init: x, y, width% = 32, height% = 64

    self.x = x
    self.y = y
    self.vx = 0
    self.vy = 0


    self.width = width
    self.height = height
    self.HP = 4

ENDFUNCTION




FUNCTION Update:

LOCAL scrwidth, scrheight
GETSCREENSIZE scrwidth, scrheight

//Schwerkraft
INC self.vy, 0.01


//Bewegung
IF KEY(203) THEN DEC self.vx, 1 //links
IF KEY(205) THEN INC self.vx, 1 //rechts
IF KEY(57)
IF Map.PickTile(self.x +self.width/2, self.y) = 2 //leiter
self.vy = 0
DEC self.y, 4

WHILE Map.PickTile(self.x +self.width/2, self.y) <> 2
INC self.y, 1
WEND

ELSEIF  (Map.CollisionPoint(self.x + 1, self.y + self.height +1) OR Map.CollisionPoint(self.x + self.width -1, self.y + self.height +1))
self.vy = -8 //space
ENDIF
ENDIF


// Tür
IF Map.PickTile(self.x +self.width/2, self.y+self.height/2) = 10
//nächste map
IF Map.NextMap$ = ""
END // to do... Menü z.B:
ELSE
Map.Init(Map.NextMap$)
ENDIF
ENDIF

//trägheit
self.vx = self.vx* 0.8

LOCAL oldx, oldy
oldx = self.x
oldy = self.y

//grenze
IF self.vy > 16 THEN self.vy = 16
IF self.vy < -16 THEN self.vy = -16


//bewege & kollision
INC self.x, self.vx


IF Map.Collision(self.X+1, self.y+1, self.width-2, self.height-2)
self.x = oldx
ENDIF
INC self.y, self.vy

IF Map.Collision(self.X+1, self.y+1, self.width-2, self.height-2)
self.x = oldx
self.y = oldy



//animation
IF ABS(self.vx)>.1
INC self.Anim, 1
self.Anim = MOD(self.Anim, 15)
ELSE
self.Anim = 13
ENDIF

//Spikes
IF Map.PickTile(self.x + 4, self.y - Map.SpikePosition*2 - 8) = 3 OR Map.PickTile(self.x + self.width - 4, self.y - Map.SpikePosition*2 - 8 ) = 3
DEC self.HP
self.Reset()
ENDIF


//trampolin
IF Map.PickTile(self.x, self.y + self.height + self.VY) = 5 OR Map.PickTile(self.x + self.width - 4, self.y + self.height + self.VY) = 5 AND ABS(self.vy)>.25
self.vy = -self.vy*1.1
ENDIF


// Gegnerkollision
FOREACH Enemy IN Enemys[]
IF Enemy.Fall = FALSE
IF BOXCOLL(self.x + 2, self.y + 2, self.width - 4, self.height - 4, Enemy.x - 4, Enemy.y - 4, Enemy.width - 8, 16) AND Enemy.IsDestroyable()
Enemy.Fall = TRUE
ELSEIF BOXCOLL(self.x + 2, self.y + 2, self.width - 4, self.height - 4, Enemy.x + 2, Enemy.y + 2, Enemy.width - 4, Enemy.height - 4)
DEC self.HP
self.Reset()
BREAK
ENDIF
ENDIF

NEXT

// fällt Spieler in Loch
IF (self.y - self.height*2)  > (Map.Height) *Tilesize
DEC self.HP
self.Reset()
ENDIF



//scrolling
Map.ScrollX = -self.x + scrwidth/2 + self.scrwidth/2
Map.ScrollY = -self.y + scrheight/2 + self.scrheight/2







ENDIF
ENDFUNCTION


FUNCTION Render:

  LOCAL CurAnim%
  IF self.Anim > 10
  CurAnim = 0
  ELSEIF self.Anim > 5
  CurAnim = 1
  ELSE
  CurAnim = 2
  ENDIF

  LOCAL Dir%
  IF self.vx < 0
  Dir = 1
  ELSE
  Dir = 0
  ENDIF

  TurnImage(PlayerImage, CurAnim, Dir, self.x + 1, self.y, self.width, self.height)


   FOR x = 0 TO self.HP*18 - 18 STEP 18
    DRAWSPRITE HerzImage, 20 + x, 20
    NEXT
ENDFUNCTION



FUNCTION Reset:

self.x = Map.SpawnX
self.y = Map.SpawnY
self.vx = 0
self.vy = 0




ENDFUNCTION



FUNCTION TurnImage: Img%, Frame%, Dir%, width%, height%, x%, y%


  LOCAL OffX = 0


  IF Dir < 0
  OffX = width
  width = -width
  ENDIF



   STRETCHANIM Img, Frame, x + Map.ScrollX + OffX, y  + Map.ScrollY, width, height



ENDFUNCTION

ENDTYPE


Map:
Code: (glbasic) [Select]
// --------------------------------- //
CONSTANT Tilesize = 128

//Spielkarte

TYPE TMap

Datas%[]
width% ; height%
ScrollX; ScrollY
X% ; Y%
Tileset% //speichert Frames
SpikePosition%
SpikeDir%
SpawnX%; SpawnY%


FUNCTION InitEmpty: width%, height%, Tileset$

self.width=width
self.height=height


DIM Enemys[0]
Player.Init(100,100)


self.Tileset = GENSPRITE()
LOADANIM Tileset$, self.Tileset, 32, 32


DIM self.Datas[self.width][self.height]



ENDFUNCTION


FUNCTION Init: Name$



LOCAL Chn% = GENFILE()
LOCAL Line$ , Tileset$


IF OPENFILE(Chn% , Name$, 1) = FALSE THEN END

READLINE Chn, Line$
self.width = INTEGER(Line$)

READLINE Chn, Line$
self.height = INTEGER(Line$)

READLINE Chn, Line$
Tileset$ = Line$


READLINE Chn, Line$
self.NextMap$ = Line$

self.InitEmpty(self.width, self. height, Tileset$)


LOCAL X%,Y%
WHILE ENDOFFILE(Chn) = FALSE
READLINE chn%, line$
LOCAL Tiles$[]

SPLITSTR (Line$, Tiles$[] ",")


X=0
FOREACH tile IN Tiles$[]
self.Datas[X][Y] = Convert(tile)
SELECT self.Datas[x][y]
  CASE 4
Player.x = x*Tilesize
Player.y = y*Tilesize
self.SpawnX = Player.x
self.SpawnY = Player.y
self.Datas[x][y] = 0
  CASE 6
  LOCAL Enemy AS TEnemy
  Enemy.Init(IS_PIG, x*Tilesize, y*Tilesize)
  self.Datas[x][y] = 0
  CASE 7
LOCAL Enemy AS TEnemy
  Enemy.Init(IS_BOSS, x*Tilesize, y*Tilesize)
  self.Datas[x][y] = 0
  CASE 8
LOCAL Enemy AS TEnemy
     Enemy.Init(IS_BIRD, x*Tilesize, y*Tilesize)
  self.Datas[x][y] = 0
  CASE 10
  DRAWSPRITE DoorImage, x*Tilesize + self.Scrollx, y*Tilesize + self.ScrollY

ENDSELECT
INC X
NEXT
INC Y



ENDFUNCTION


FUNCTION Update:
IF self.SpikeDir
DEC self.SpikePosition 0.5
IF self.SpikePosition <= 0
self.SpikePosition = 0
self.SpikeDir = FALSE
ENDIF
ELSE

INC self.SpikePosition 0.5
IF self.SpikePosition >= Tilesize
self.SpikeDir = TRUE
self.SpikePosition = Tilesize
ENDIF

ENDFUNCTION



FUNCTION Render:
FOR x = 0 TO self.Width -1
FOR y = 0 TO self.Height -1

RenderTile(self.Datas[x][y], x, y)

NEXT
NEXT

ENDFUNCTION



FUNCTION RenderTile: Tile%, x, y

SELECT Tile

CASE 0
CASE 1
//DRAWRECT x*tilesize + self.ScrollX, y*tilesize + self.ScrollY, tilesize, tilesize, RGB(255, 0, 0)
LOCAL Tile% = 0
IF (y = 0 OR IsCollisionTile(self.Datas[x][y-1])) AND (x = 0 OR IsCollisionTile(self.Datas[x-1][y]))
IF (y = 0 OR IsCollisionTile(self.Datas[x][y-1])) AND (x = (self.width - 1) OR IsCollisionTile self.Datas[x+1][y] = 0)
Tile = 1
ELSE
Tile = 2
ENDIF
ELSEIF (y = 0 OR IsCollisionTile(self.Datas[x][y-1])) AND (x = (self.width - 1) OR IsCollisionTile(self.Datas[x+1][y]))
Tile = 3
ELSEIF y = 0 OR IsCollisionTile(self.Datas[x][y-1])
Tile = 1
ELSE
Tile = 0
ENDIF

DRAWANIM self.Tileset, Tile, x*Tilesize + self.ScrollX, y*Tilesize + self.ScrollY
CASE 2
//DRAWRECT x*tilesize + self.ScrollX, y*tilesize + self.ScrollY, Tilesize, Tilesize, RGB(255,0,0)
DRAWSPRITE LeiterImage, x*Tilesize + self.ScrollX, y*Tilesize + self.ScrollY
CASE 3
//DRAWRECT x*tilesize + self.ScrollX, y*tilesize + self.ScrollY + self.SpikePosition, Tilesize, Tilesize, RGB(255,0,0)
DRAWSPRITE SpikeImage, x*Tilesize + self.ScrollX, y*Tilesize + self.ScrollY + self.SpikePosition
// CASE 4 Spawnpunkt

CASE 5
//DRAWSPRITE x*tilesize + self.ScrollX, y*tilesize + self.ScrollY, Tilesize, Tilesize, RGB(255,0,0)
DRAWSPRITE TrampolinImage, x*Tilesize + self.ScrollX, y*Tilesize + self.ScrollY
ENDSELECT

ENDFUNCTION



//gibt das tile an der gegebenen stelle zurück

FUNCTION PickTile: x, y
IF x >= 0 AND y >= 0 AND x < self.Width*Tilesize AND y < self.Height*Tilesize //in der map
x = INTEGER
y = INTEGER
RETURN self.Datas[x][y]
ELSE
RETURN 0
ENDIF


ENDFUNCTION




// Punktkollision

FUNCTION CollisionPoint: X, Y
LOCAL TmpY = y
IF X >= 0 AND Y >= 0 AND X < self.Width*Tilesize AND Y < self.Height*Tilesize //in der map
X = INTEGER
Y = INTEGER

IF IsCollisionTile(self.Datas[X][Y]) = FALSE

IF self.Datas[x][y] = 5
//halbteil
IF MOD(TmpY, 32) = 16
RETURN TRUE
ELSE
RETURN FALSE
ENDIF
ENDIF

RETURN TRUE
ELSE
RETURN FALSE
ENDIF
ELSE
RETURN FALSE
ENDIF

ENDFUNCTION


// Rechteckskollision

FUNCTION Collision%: X, Y, Width, Height

IF CollisionPoint(X,Y) OR CollisionPoint(X + Width, Y) OR CollisionPoint(X, Y + Height) OR CollisionPoint(X + Width, Y + Width)
RETURN TRUE
ELSE
RETURN FALSE
ENDIF
ENDFUNCTION



FUNCTION IsCollisionTile%: Typ%
IF Typ = 0 OR Typ = 2 OR Typ = 3 OR Typ = 10
RETURN TRUE
ELSE
RETURN FALSE
ENDIF

ENDFUNCTION

FUNCTION Convert: Text$
SELECT Text$
CASE "A"
RETURN 10
DEFAULT
RETURN INTEGER(Text$)
ENDSELECT

ENDFUNCTION




ENDTYPE


Enemy:
Code: (glbasic) [Select]
// --------------------------------- //
// Project: My Jump and Run
// Start: Monday, March 04, 2013
// IDE Version: 10.202


// FREE-VERSION:
// Benötigt Premium für Feature:
// 3D Grafik
// Netzwerk Befehle
//INLINE C/C++ Code


CONSTANT IS_BIRD = 1
CONSTANT IS_PIG = 2
CONSTANT IS_BOSS = 3
CONSTANT Tilesize = 128


GLOBAL Enemys[]AS TEnemy


TYPE TEnemy

Typ%// Vogel =1, Schwein = 2 und Endboss = 3
x; y
vx; vy
width%; height%
ScrollX%; ScrollY%
Anim%
Tilesize%
Fall%

FUNCTION Update:
IF self.Fall
self.vy = self.vy + .2

INC y, self.vy
ELSE

INC self.Anim
SELECT self.Typ

CASE IS_BIRD
IF (Map.CollisionPoint(self.x + 2 + self.vx + self.width, self.y + self.height/2)) OR self.x + self.vx < 0 OR self.x + self.vx > Map.width*Tilesize
self.vx = -self.vx
ENDIF
INC self.x, self.vx
INC self.y, COS(GETTIMERALL()/10)
IF Map.Collision(self.x + 4, self.y + self.vy, self.width - 8, self.height)
self.vy = 0
ENDIF

INC self.y, self.vy



CASE IS_BOSS
IF (Map.CollisionPoint(self.x - 1 + self.vx, self.y + height + 1) = FALSE OR Map.CollisionPoint(self.x + self.width + 1 + self.vx, self.y + self.height + 1) = FALSE) OR (Map.CollisionPoint(self.x + 2 + self.vx + self.width, self.y + self.height/2)) OR self.x + self.vx < 0 OR self.x + self.vx > Map.width*Tilesize
self.vx = -self.vx
ENDIF
INC self.x, self.vx


ENDSELECT
ENDIF
ENDFUNCTION



FUNCTION Render:

LOCAL Frame% = 0



SELECT self.Typ
CASE IS_BIRD
LOCAL Dir%
IF self.vx > 0
Dir = 1
ELSE
Dir = 0
ENDIF
IF self.Anim > 10
Frame = 1
ELSE
Frame = 0
ENDIF
self.Anim = MOD(self.Anim, 15)

TurnImage(BirdImage, Frame, Dir, self.x, self.y, 32, 16)
CASE IS_PIG
IF self.Anim = 5
Frame = 1
ELSE
Frame = 0
ENDIF


TurnImage(PigImage, Frame, Dir, self.x, self.y, Tilesize, Tilesize)

self.Anim = MOD(self.Anim, 10)

CASE IS_BOSS
ROTOSPRITE BossImage, self.x + Map.ScrollX, self.y + Map.ScrollY , -MOD(self.x, 360)

ENDSELECT

ENDFUNCTION



FUNCTION Init: Typ%, x, y
self.Typ = Typ
self.x = x
self.y = y
self.width = Tilesize
self.height = Tilesize
SELECT self.Typ


CASE IS_BIRD
self.height = Tilesize/2
IF INTEGER (RND(2))
self.vx = 2
ELSE
self.vx = -2
ENDIF

CASE IS_PIG
IF INTEGER (RND(2))
self.vx = 2
ELSE
self.vx = -2
ENDIF

CASE IS_BOSS
self.y = self.y - Tilesize
self.width = self.width*2
self.height = self.height*2
IF INTEGER (RND(2))
self.vx = 2
ELSE
self.vx = -2
ENDIF

ENDSELECT

DIMPUSH Enemys[], self

ENDFUNCTION


FUNCTION IsDestroyable:
IF self.Typ = IS_BOSS
RETURN FALSE
ELSE
RETURN TRUE
ENDIF


ENDTYPE
Map 0
Code: (glbasic) [Select]
25
6
tileset1.png

1,1,8,1,1,1,1,1,1,1,0,1,1,7,1,0,0,0,0,0,0,0,0,0,0
1,1,0,1,1,1,1,1,1,1,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0
1,1,3,1,1,1,1,1,1,1,2,1,1,1,0,0,0,0,0,6,0,0,0,0,0
4,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,1,0,0,0,0,A
1,1,0,1,0,1,1,1,5,1,1,1,0,1,1,0,0,1,1,0,0,0,1,1,1
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0


+ DD GUI...


14
Bug Reports / Re: DDgui.gbas (1168) Error
« on: 2013-Mar-06 »
I only use height% as local...

Should I post you my Code ?

15
Bug Reports / Re: DDgui.gbas (1168) Error
« on: 2013-Mar-06 »
hmm I#ll check that, ty for the answer.

Pages: [1] 2 3