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.


Topics - xxbastianxx

Pages: [1]
1
Bug Reports / Jump and Run Errors
« on: 2013-Mar-06 »
Hey guys,

Im just making a Map Editor with the implemented code of ddgui.. but if I compile it shows me : "DDgui.gbas (1168) error : redefinition as different type : height is of Type DGInt

--> ddgui_vals.main.wscrollmax% = MAX(0, ddgui_vals.realheight% - height% - 12)                 [thats where the mistake is in programm]


Can you help me ?

2
FAQ / Map Editor implementation
« on: 2013-Mar-04 »
Hey guys,

I'd like to implement a map editor in my jump and run... I cant find that in the help section of GL Basic...

could someone give me an example ? And is it maybe possible that there is a tool for that ?

TY

3
Hi guys,

allways when i open GL Basic on my desktop PC (win7 x64) it disappears next to my screen --> it goes to the right out of the screen...

can somebody help ?


Sorry, I dont know if this thread is in the right place  ...


Regards Seb

4
Hallo liebe community,

ich habe vor kurzem angefangen mit GLBASIC ein Jump n Run zu programmieren. Den Spieler habe ich erfolgreich erstellt... nun versuche ich vergeblich eine Map zu erstellen.


Mein Code:

Code: (glbasic) [Select]
// --------------------------------- //
// Project: My Jump AND Run
// Start: Monday, October, 2012
// IDE Version: 10.202


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






//Features:
// Singelplayer
// Level
// Levelwechsel
// Gegner
// Pixelgrafik
// Leitern
// Trampolin
// Spikes
// Start-/Zielpunkt
// ...







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


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



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



GOSUB Init
WHILE TRUE


   GOSUB Render
   GOSUB Update


   SHOWSCREEN

WEND


SUB Init:

Player.Init (100,100)
Map.Init("map0.txt")

ENDSUB

SUB Update:

Player.Update()
Map.Update ()


ENDSUB


SUB Render:

Map.Render ()
    Player.Render()



ENDSUB







Mein Spieler Code: (Kollision bitte auslassen)

Code: (glbasic) [Select]

//Spieler

TYPE TPlayer

x; y
vx; vy //Vektor x,y
width%
height%
HP%
scrollx; scrolly

//...

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

ENDFUNCTION




FUNCTION Update:

LOCAL width, height
GETSCREENSIZE width, height

//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) AND (Map.CollisionPoint(self.x + 1, self.y + self.height +1) OR Map.CollisionPoint(self.x + self.width -1, self.y + self.height +1)) THEN self.vy = -4 //space


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

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

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


//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

// Map.ScrollX = -self.x + width/2 + self.width/2
// Map.ScrollY = -self.y + height/2 + self.height/2


// ENDIF
ENDFUNCTION



FUNCTION Render:

   DRAWRECT self.x + 1, self.y , self.width, self.height, RGB(255,0,0)
//   DRAWANIM PlayerImage, 0, self.x + 1, self.y


ENDFUNCTION

ENDTYPE



Meine Map:

Code: (glbasic) [Select]
// --------------------------------- //
// Project: My Jump and Run
// Start: Wednesday, January 23, 2013
// IDE Version: 10.202


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


CONSTANT tilesize = 64

//Spielkarte

TYPE TMap

.Datas%[]
Width% ; Height%
ScrollX; ScrollY
Tileset% //speichert Frames



FUNCTION Init: Name$
LOCAL Chn% = GENFILE()
LOCAL Line$

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

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

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

DIM self.Datas[self.Width][self.Height]


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] = INTEGER(tile)
INC X
NEXT
INC Y



ENDFUNCTION

FUNCTION Update:

ENDFUNCTION

FUNCTION Render:
FOR x = 0 TO self.Width -1
FOR y = 0 TO self.Height -1
SELECT self.Datas[x][y]
CASE 0
CASE 1
DRAWRECT x*tilesize, y*tilesize, tilesize, tilesize, RGB(255, 0, 0)
ENDSELECT
NEXT
NEXT

ENDFUNCTION


ENDTYPE




Die Map soll via Texteditor 0,1,2 etc. eingelesen werden und dann entsprechend in Farbe oder nicht Farbe gesetzt werden. (0 nichts , 1 Mapstück)

Nach dem compilen gibt er mir folgende Fehleranzeige aus: "My Jump and Run.gbas"(66) error : user type is not defined : TYPE TMap is not declared


Ich bitte um Hilfe...

5
Hi, Bug Report: *** Configuration: WIN32 ***
precompiling:
GPC - GLBasic Precompiler V.10.104 SN:409de90b - 2D, WIN32
"Player.gbas"(72) warning : probably unassigned variable : width
"Player.gbas"(73) warning : probably unassigned variable : height

  given: TPlayer
  wants: Anything
"My Jump and Run.gbas"(39) error : wrong argument type : LOADANIM, arg no: 2

     :nw: help




Code: (glbasic) [Select]
[b]--> Jump and Run (Main Code)[/b]

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

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


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




GOSUB Init
WHILE TRUE


   GOSUB Render
   GOSUB Update


   SHOWSCREEN

WEND

SUB Update:

Player.Update()
Map.Update ()


ENDSUB


SUB Render:

Map.Render ()
Player.Render()



ENDSUB


SUB Init:

Player.Init (100,100)
Map.Init("map0.txt")

ENDSUB


[b]Player[/b]

TYPE TPlayer

x; y
vx; vy //Vektor x,y
width%
height%
HP%
scrollx; scrolly

//...

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

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) AND (Map.CollisionPoint(self.x + 1, self.y + self.height +1) OR Map.CollisionPoint(self.x + self.width -1, self.y + self.height +1)) THEN self.y = -4 //space


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

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

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


//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

Map.scrollx = - self.x + scrwidth/2 + width/2
Map.scrolly = - self.y + scrheight/2 + height/2

ENDIF
ENDFUNCTION


FUNCTION Render:

   DRAWRECT self.x + 1 + Map.scrollx, self.y + Map.scrolly, self.width, self.height, RGB(255,0,0)
   DRAWSPRITE PlayerImage, 0, self.x + 1 + Map.scrollx, self.y + Map.scrolly 


ENDFUNCTION

ENDTYPE



[b]Map[/b]

CONSTANT tilesize = 64

//Spielkarte
TYPE TMap

data$[]
width% ; height%
scrollx; scrolly
Tilesize% //speichert Frames


FUNCTION Init: Name$

LOCAL chn% = GENFILE ()
LOCAL line$



IF OPENFILE ( chn, name$ ,  1) = FALSE THEN END

READLINE chn, line$
width.self = INTEGER (line$)

READLINE chn, line$
width.self = INTEGER (line$)

DIM self.datas[self.width][self.height]

WHILE ENDOFFILE (chn%) = FALSE
READLINE chn% , line$
LOCAL tile$[]

SPLITSTR (line$, tile$[], ",")

FOREACH tile IN tile$[]


x=0
FOREACH tile IN tile$ []
self.datas$ [x][y] = INTEGER(tile)
INC x
NEXT

INC y
WEND


ENDFUNCTION


FUNCTION Update:

ENDFUNCTION


FUNCTION Render:
FOR x = 0 TO self.width - 1
FOR y = 0 TO self.height -1
SELECT self.datas$[x][y]
CASE 0
CASE 1
DRAWRECT x*tilesize + self.scrollx, y*tilesize + scrolly, tilesize, tilesize , RGB(0, 255 ,0)
ENDSELECT
NEXT
NEXT
ENDFUNCTION




FUNCTION Collision%:  x, y, width, height

IF x >= 0 AND y >= 0 AND x < self.width*Tilesize AND y < self.height*Tilesize

x = INTEGER(x/Tilesize)
y = INTEGER(y/Tilesize)

IF self.Datas[x][y]
RETURN TRUE
ELSE
RETURN FALSE
ENDIF



ENDFUNCTION




FUNCTION CollisionPoint%: x, y
//eckpunkte
IF CollisionPoint(x, y) OR CollisionPoint(x, y + width) OR CollisionPoint(x, y + height) OR CollisionPoint(x + width, y + height)
RETURN TRUE
ELSE
RETURN FALSE

ENDIF

ENDFUNCTION


ENDTYPE


6
Hey guys,

I've just started with programming and im using a Tutorial on youtube to make my first Jump n Run game. I did exactly as it's done in the Video but i get a Bug Report (fatal error)  :'(

The Turorial (I'm German so I needed a German tut...):

No.1
No.2

Bug Report:
GPC - GLBasic Precompiler V.10.104 SN:409de90b - 2D, WIN32Wordcount:34 commandscompiling:C:\Users\SEBAST~1\AppData\Local\Temp\glbasic\gpc_tempg.cpp: In member function `DGInt __GLBASIC__::TPlayer::Update()':C:\Users\SEBAST~1\AppData\Local\Temp\glbasic\gpc_tempg.cpp:47: error: invalid initialization of non-const reference of type 'bool&' from a temporary of type 'bool'C:/Program Files (x86)/GLBasic/Compiler/platform/Include/glb.h:1182: error: in passing argument 1 of `void __GLBASIC__::INC(T&) [with T = bool]'*** FATAL ERROR - Bitte die Compiler-Ausgabe ins Forum kopieren

My Codes:
Code: (glbasic) [Select]
SETCURRENTDIR("Media") // go to media files

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

GOSUB InitWHILE TRUE

   GOSUB Update   GOSUB Render

   SHOWSCREEN

WEND

SUB Update:

Player.Update() Map.Update ()

ENDSUB

SUB Render:

Player.Render() Map.Render ()

ENDSUB

SUB Init:

Player.Init (100,100) Map.Init("map0.map")

ENDSUB

//Spieler

TYPE TPlayer

x; y vx; vy //Vektor x,y width%; height% HP% //...

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

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

    self.width = width    self.height = height

ENDFUNCTION

FUNCTION Update:

//Schwerkraft INC self.vy = 0.5

//Bewegung IF KEY(203) THEN DEC self.vx, 1 //links IF KEY(205) THEN INC self.vx, 1 //rechts

// IF KEY(200) THEN INC self.vy, 2 //oben// IF KEY(208) THEN DEC self.vy, 2 //unten

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

//bewege INC self.x, self.vx INC self.y, self.vy

ENDFUNCTION

FUNCTION Render:

    DRAWRECT self.x, self.y, self.width, self.height, RGB(255,0,0)

ENDFUNCTION

ENDTYPE




Thank You for any Help guys!

Edit: Changed to code tags /Moru

Pages: [1]