Page 2 sur 3

Re: Petit remake d'un Mario sur Atari 7800

Publié : ven. 27/mars/2020 11:53
par Ar-S
Yo G-ROM, sur le lien, toutes les videos montrent des jeux 3D.. C'est tune lib 2D ou bien ?
ça a l'air d'avoir plein d'atouts en tout cas.

Re: Petit remake d'un Mario sur Atari 7800

Publié : ven. 27/mars/2020 12:02
par G-Rom
C'est une lib de rendu bas niveau qui fait abstraction de l'API , tu fait ce qui te plait ensuite , de la 2D , et si tu est motivé un engine 3D... mais tout seul faire un Engine3D , c'est même pas la peine... mais la 2D reste abordable.
Dans ce cas de figure , avec cette lib , pas besoin de se taper du code DX ou OpenGL ou Vulkan , la lib fait "passerelle" (je préfère le terme abstraction) entre les différentes API dispo.

par exemple , en pseudo code :
Vertex vertices[4]
vertices[0] = Vector2(0,0)
vertices[1] = Vector2(1,0)
vertices[2] = Vector2(1,1)
vertices[3] = Vector2(0,1)

DrawQuad( @vertices )
En fonction du renderer choisi , la lib fait appel aux différentes API dispo , ici en pseudo code , pas d'appel direct en Opengl ou DX.

Re: Petit remake d'un Mario sur Atari 7800

Publié : ven. 27/mars/2020 13:39
par Ollivier
C'est déjà dispo en open source cpp et accessible dans un Basic plus ancien...

Re: Petit remake d'un Mario sur Atari 7800

Publié : ven. 27/mars/2020 14:10
par G-Rom
de quoi tu parles ? de DarkBasic Pro , BlitzBasic ? même si c'est opensource, c'est pas adaptable tel quel à PB , puis c'est pas multi-plateforme et complètement vieillot...

Re: Petit remake d'un Mario sur Atari 7800

Publié : ven. 27/mars/2020 15:42
par Ollivier
Je crois que c'est QuickBasic.

Re: Petit remake d'un Mario sur Atari 7800

Publié : ven. 27/mars/2020 16:14
par G-Rom
Has been aussi , qu'est ce que tu veut en faire ?

Re: Petit remake d'un Mario sur Atari 7800

Publié : ven. 27/mars/2020 16:31
par Ollivier
L'absence de pointeur, effectivement alourdit la programmation, mais, c'est fonctionnellement tout ce qui manque, si ça n'a pas été rajouté ou substitué depuis, comme dans le SB de Fred.

Re: Petit remake d'un Mario sur Atari 7800

Publié : ven. 27/mars/2020 18:50
par G-Rom
Je ne vois toujours pas le rapport avec la discutions sur bgfx, pourquoi on parle de cela ? 8O

Re: Petit remake d'un Mario sur Atari 7800

Publié : sam. 28/mars/2020 9:26
par Marc56
[off topic]
Je crois que c'est QuickBasic.
Has been aussi
Successeur compatible: QB64 en dernière version stable février 2020
L'absence de pointeur, effectivement alourdit la programmation, mais, c'est fonctionnellement tout ce qui manque, si ça n'a pas été rajouté ou substitué depuis, comme dans le SB de Fred
:arrow: QB64 Pointeurs et tout, mais que du texte.

:wink:
[/off topic]

Re: Petit remake d'un Mario sur Atari 7800

Publié : ven. 03/avr./2020 23:16
par Ollivier
7700 points
2,5 gigas de RAM utilisés (je... "?")

Les graphismes...

Beh à première vue... Ils sont... moches ! Et justement, si c'est tiré de l'original, c'est incroyable de voir l'évolution et l'illusion réussie.

Les couleurs (palette) c'est quand même bien optimisé pour pomper juste 15 couleurs (même pas 16)
Pareil pour les briques et autres déco : avec peu (8*8) c'est vraiment artistique.

Moi qui ai tenté de reproduire sans modèle, à chaque fois, je me suis confronté à la palette EGA et à mon propre perfectionnisme inutile (16 * 16) et n'ai jamais réussi à redessiner correctement le minimum pour un Mario.

Quand on recule un peu son regard, tout est finalement nickel. Ce graphisme me fait penser à ceux de la Game Boy où, pareil, de près, c'est moche, mais (pas "de loin") à distance d'utilisation, c'est impeccable et cohérent.

Bien joué !

Re: Petit remake d'un Mario sur Atari 7800

Publié : sam. 04/avr./2020 7:30
par Ollivier

Code : Tout sélectionner

;******************************************************************************************************************************************************************************************************************************************************************************************************************************************
;
; - Mario Atari 7800 pseudo clone
;             GRom
;
; + Coin wrap
; + Score doublé si combo
; + Obus vulnérable
; /!\ Pas trouvé problème mémoire

#WAVE_FILE = 0 ; undef this if you dont have sound media

Macro PlaySoundEX(id,flag)
       CompilerIf #WAVE_FILE
              PlaySound(id,flag)
       CompilerEndIf
EndMacro   

RandomSeed( Random($FFFFFF) )

Structure Entity
       SpriteId.l
       X.d
       Y.d
       VX.d
       VY.d
       AnimTime.l
       AnimSpeed.l
       FlipMe.b
       anim_left_min.l
       anim_left_max.l
       anim_right_min.l
       anim_right_max.l
       jumping.b
       jump_height.d
       onground.b
       max_velx.d
       max_vely.d 
       gravity.f
       use_physic.b
       is_ghost.b
       blink.l
       wrap.b
       deleteme.b
EndStructure


Structure Pnj Extends Entity
       jumper.b
       jump_time.l  
       jump_delay.l
       direction.l ; 1 right , 0 left
       entry_mode.l; 1 out ; 0 in
       collide_time.l ; prevent infinite collision
       is_cool.b
EndStructure

Structure Coin Extends Entity
       direction.l ; 1 right , 0 left
       uncollect_time.l ; prevent collect at spawn
EndStructure


Structure Player Extends Entity
       is_die.b  
       freeze_time.l
       invincible.b
       invincible_time.l
       life.l
       next_life.l
       score.l
EndStructure

Structure Missile Extends Entity
       IsFalling.I
       direction.l
EndStructure




Global max_mob = 1
Global mob_spawn_delay
Global speed_factor.f = 1
Global Mario.Player
Global NewList Mob.Pnj()
Global NewList Bonus.Coin()
Global NewList Missile.Missile()

Global ScoreDelta = 50


Mario\x = 8 * 8
Mario\y = (10 * 8) 
Mario\spriteid = 12
Mario\jump_height = 3.8
Mario\animspeed = 50
Mario\anim_right_min = 12
Mario\anim_right_max = 14
Mario\anim_left_min = 18
Mario\anim_left_max = 20
Mario\gravity = 0.2
Mario\use_physic = #True 
Mario\is_die = #False 
Mario\is_ghost = #False 
Mario\invincible = #False 
Mario\life = 3
Mario\wrap = #True 
Mario\next_life = 3000

Declare.l getcolor(rgb)
Declare draw_value(value.l,x,y)
Declare check_solid(x.d,y.d)
Declare is_solid(tilex,tiley)
Declare spawn_mob()
Declare draw_entity(*e.entity)
Declare update_physic(*e.Entity)
Declare entity_collide(*a.Entity, *b.Entity)
Declare entity_collide_point(*e.entity,x.f,y.f, velocity.b = #False)
Declare spawn_coin(x,y,d)
Declare spawn_missile(y)
Declare draw_missile(*m.Missile)
Declare update_missile(*m.missile)




InitSprite() : InitKeyboard() : InitMouse() : InitSound() : joypad = InitJoystick()
ExamineDesktops()
Global dw = DesktopWidth(0)
Global dh = DesktopHeight(0)
Global deltatime.d = 0

OpenScreen(dw,dh,32,"",#PB_Screen_NoSynchronization)
Global gpu_texture = CreateSprite(#PB_Any,48,48,#PB_Sprite_AlphaBlending)

Global Dim Color.l(16)
CopyMemory(?palette, @Color(), ?end_palette - ?palette) 

Global Dim Texture.b(48*48)
CopyMemory(?texture, @Texture(), ?end_texture - ?texture) 

Global Dim Tilemap.b(19*16)
CopyMemory(?tilemap, @Tilemap(), ?end_tilemap - ?tilemap) 

Global Dim SolidTile.b(?end_solid_tile - ?solid_tile)
CopyMemory(?solid_tile, @SolidTile(), ?end_solid_tile - ?solid_tile) 

Global Dim SubSprite.l(36)

StartDrawing(SpriteOutput(gpu_texture))
For y = 0 To 47
       For x = 0 To 47
              index = x + 48 * y
              Plot(x,y, Color( Texture(index) ) )
       Next
Next
StopDrawing()


DisplaySprite(gpu_texture,0,0)
For clip = 0 To 35
       x = clip % 6
       y = clip / 6
       SubSprite(clip) = GrabSprite(#PB_Any,x*8,y*8,8,8) 
       TransparentSpriteColor(SubSprite(clip), RGB(255,0,255))
Next


CompilerIf #WAVE_FILE
       ;   sound_jump    = LoadSound(#PB_Any,"jump.wav")
       ;   sound_hurt    = LoadSound(#PB_Any,"hurt.wav")
       ;   sound_kill    = LoadSound(#PB_Any,"kill.wav")
       ;   sound_coin    = LoadSound(#PB_Any,"coin.wav")
       ;   sound_fall    = LoadSound(#PB_Any,"falling.wav")
       ;   sound_respawn = LoadSound(#PB_Any,"respawn.wav")
       ;   sound_rejump  = LoadSound(#PB_Any,"rejump.wav")
       ;   sound_missile  = LoadSound(#PB_Any,"missile.wav")
       ;   sound_extralife  = LoadSound(#PB_Any,"extralife.wav")
       
       
       sound_jump    = CatchSound(#PB_Any,?bin_sound_jump, ?bin_sound_jump_e - ?bin_sound_jump)
       sound_hurt    = CatchSound(#PB_Any,?bin_sound_hurt, ?bin_sound_hurt_e - ?bin_sound_hurt)
       sound_kill    = CatchSound(#PB_Any,?bin_sound_kill, ?bin_sound_kill_e - ?bin_sound_kill)
       sound_coin    = CatchSound(#PB_Any,?bin_sound_coin, ?bin_sound_coin_e - ?bin_sound_coin)
       sound_fall    = CatchSound(#PB_Any,?bin_sound_falling, ?bin_sound_falling_e - ?bin_sound_falling)
       sound_respawn = CatchSound(#PB_Any,?bin_sound_respawn, ?bin_sound_respawn_e - ?bin_sound_respawn)
       sound_rejump  = CatchSound(#PB_Any,?bin_sound_rejump, ?bin_sound_rejump_e - ?bin_sound_rejump)
       sound_missile  = CatchSound(#PB_Any,?bin_sound_missile, ?bin_sound_missile_e - ?bin_sound_missile)
       sound_extralife = CatchSound(#PB_Any,?bin_sound_extralife, ?bin_sound_extralife_e - ?bin_sound_extralife)
       
       
       
       
       
       
       
       
CompilerEndIf 


; spawn_missile(14)
missile_timer = ElapsedMilliseconds() + 4000
missile_middle_timer = ElapsedMilliseconds() + 10000

; boucle principale
;
accumulator.d = 0
While #True
       ExamineKeyboard()
       
       deltatime = (ElapsedMilliseconds() - lasttime.d) / 1000
       lasttime = ElapsedMilliseconds()
       accumulator + deltatime
       
       If mob_spawn_delay < ElapsedMilliseconds() And ListSize(Mob()) < max_mob
              mob_spawn_delay = ElapsedMilliseconds() + Random(3000,750)
              spawn_mob()
       EndIf
       
       
       ;
       ;-INPUT
       ;
       If KeyboardPushed(#PB_Key_Escape)
              Break
       EndIf
       
       
       If Mario\is_die = #False 
              
              If joypad
                     If ExamineJoystick(0)
                            joy_axisx = JoystickAxisX(0) 
                            joy_button = JoystickButton(0,3)
                     EndIf
              EndIf 
              
              If KeyboardPushed(#PB_Key_Right) Or joy_axisx = 1
                     Mario\vx = 1
                     Mario\flipme = #False 
              EndIf
              
              If KeyboardPushed(#PB_Key_Left) Or joy_axisx = -1
                     Mario\vx = -1
                     Mario\flipme = #True 
              EndIf
              
              If KeyboardPushed(#PB_Key_Space) Or joy_button = 1
                     Mario\jumping = #True 
                     
                     If sound_jump_flag = 0
                            sound_jump_flag = 1
                            PlaySoundEX(sound_jump,#PB_Sound_MultiChannel)
                     EndIf 
                     
              Else
                     sound_jump_flag = 0
                     Mario\jumping = #False      
              EndIf
              
              If Not (KeyboardPushed(#PB_Key_Right) Or joy_axisx = 1) And Not (KeyboardPushed(#PB_Key_Left)  Or joy_axisx = -1 )
                     Mario\vx = 0    
              EndIf
              
       EndIf 
       
       
       ;-GAME LOGIC
       
       ; Spawn missile
       
       If Mario\y < 32 And missile_timer < ElapsedMilliseconds()
              missile_timer = ElapsedMilliseconds() + 5000
              spawn_missile(Random(2))
              PlaySoundEX(sound_missile,#PB_Sound_MultiChannel)
       ElseIf Mario\y > 32
              missile_timer = ElapsedMilliseconds() + 5000
       EndIf   
       
       If Mario\y > 32 And Mario\y< 96 And missile_middle_timer < ElapsedMilliseconds()
              missile_middle_timer = ElapsedMilliseconds() + 10000
              spawn_missile(Random(10,4))
              PlaySoundEX(sound_missile,#PB_Sound_MultiChannel)
       ElseIf (Mario\y < 32 Or Mario\y > 96)
              missile_middle_timer = ElapsedMilliseconds() + 10000
       EndIf   
       
       
       
       If Mario\score => Mario\next_life 
              Mario\next_life + 3000
              Mario\life + 1
              PlaySoundEX(sound_extralife,#PB_Sound_MultiChannel)
       EndIf 
       
       ; Mario die ( jumping )
       If Mario\is_die And Mario\freeze_time < ElapsedMilliseconds() And Mario\use_physic = #False 
              Mario\use_physic = #True   
              Mario\vy = -Mario\jump_height
              PlaySoundEX(sound_fall,#PB_Sound_MultiChannel)
       EndIf
       
       If Mario\is_die And Mario\y > 2048
              Mario\invincible = #True 
              Mario\invincible_time = ElapsedMilliseconds() + 2000
              Mario\x = 8 * 8
              Mario\y = (10 * 8) 
              Mario\vy = 0
              Mario\vx = 0
              Mario\is_ghost = #False 
              Mario\is_die = #False 
              PlaySoundEX(sound_respawn,#PB_Sound_MultiChannel)
       EndIf
       
       
       If Mario\invincible And Mario\invincible_time > ElapsedMilliseconds()
              Mario\blink+1 : Mario\blink%4
       ElseIf Mario\invincible And Mario\invincible_time < ElapsedMilliseconds()
              Mario\invincible = #False 
              Mario\blink = 0
       EndIf 
       
       ForEach(Bonus())
              
              If( entity_collide_point(@Mario,Bonus()\x + 4 , Bonus()\y + 4) ) And Bonus()\uncollect_time < ElapsedMilliseconds()
                     Mario\score + 1000
                     
                     PlaySoundEX(sound_coin,#PB_Sound_MultiChannel)
                     
                     If DeleteElement(Bonus(),1)=0
                            Break
                     EndIf 
                     
              EndIf
              
              If Bonus()\direction = 1
                     Bonus()\vx = 0.5
              Else
                     Bonus()\vx = -0.5
              EndIf
              
              If Bonus()\deleteme
                     DeleteElement(Bonus())
              EndIf    
       Next
       
       
       ForEach(@Mob())
              
              Mob()\vx = 0.2
              
              If Mob()\jumper = #True 
                     If Mob()\jump_time < ElapsedMilliseconds()
                            Mob()\jump_time = ElapsedMilliseconds() + Mob()\jump_delay
                            Mob()\jumping = #True 
                     Else
                            Mob()\jumping = #False
                     EndIf
              EndIf 
              
              If Mob()\direction = 1
                     Mob()\vx = 0.25
              Else
                     Mob()\vx = -0.25
              EndIf 
              
              
              ; down pipe enter
              ;
              If Round(Mob()\x/8,#PB_Round_Down) = 2 And Round(Mob()\y/8,#PB_Round_Down) = 14 And Mob()\vx < 0
                     Mob()\use_physic = #False 
                     Mob()\entry_mode = 0
                     Mob()\is_cool = #True 
              EndIf
              
              If Round(Mob()\x/8,#PB_Round_Down) = 14 And Round(Mob()\y/8,#PB_Round_Down) = 14 And Mob()\vx > 0
                     Mob()\use_physic = #False 
                     Mob()\entry_mode = 0
                     Mob()\is_cool = #True
              EndIf
              
              
              If Mob()\use_physic = #False 
                     
                     ; down pipe enter move
                     If Mob()\entry_mode = 0
                            If Round(Mob()\y/8,#PB_Round_Down) > 12
                                   Mob()\y - 0.25
                            EndIf 
                            
                            ; left pipe
                            If Mob()\vx < 0 And Round(Mob()\y/8,#PB_Round_Down) = 12
                                   Mob()\x - 0.25
                                   If Round(Mob()\x/8,#PB_Round_Down) = 0
                                          Mob()\x  = 1*8
                                          Mob()\y  = 1*8
                                          Mob()\entry_mode = 1
                                          Mob()\direction = 1
                                          Mob()\jump_time = ElapsedMilliseconds() + Mob()\jump_delay
                                   EndIf             
                            EndIf 
                            
                            ; right pipe
                            If Mob()\vx > 0 And Round(Mob()\y/8,#PB_Round_Down) = 12
                                   Mob()\x + 0.25
                                   If Round(Mob()\x/8,#PB_Round_Down) = 16
                                          Mob()\x  = 16*8
                                          Mob()\y  = 1*8
                                          Mob()\entry_mode = 1
                                          Mob()\direction = 0
                                          Mob()\jump_time = ElapsedMilliseconds() + Mob()\jump_delay
                                   EndIf 
                            EndIf 
                     EndIf 
                     
                     ; up pipe exit
                     If Mob()\entry_mode = 1
                            If Mob()\vx > 0
                                   Mob()\x + 0.25  
                                   If Round(Mob()\x/8,#PB_Round_Down) = 2 : Mob()\use_physic = #True : Mob()\is_cool = #False : EndIf
                            EndIf
                            
                            If Mob()\vx < 0
                                   Mob()\x - 0.25 
                                   If Round(Mob()\x/8,#PB_Round_Down) = 14 : Mob()\use_physic = #True : Mob()\is_cool = #False : EndIf
                            EndIf
                            
                     EndIf
              EndIf
              
       Next
       
       
       
       While ( accumulator > 1.0/60.0 )
              ;-PHYSIC
              ;
              
              update_physic(@Mario)
              
              ForEach (Bonus())
                     update_physic(@Bonus())  
              Next
              
              ; collide Mob/Mob , Mob/Mario
              ForEach(Mob())
                     
                     ; mob / mob 
                     *c.Pnj = @Mob()
                     PushListPosition(Mob())
                     ForEach Mob()
                            
                            If @Mob() <> *c And Mob()\collide_time < ElapsedMilliseconds()
                                   If entity_collide(*c,@Mob())
                                          *c\direction + 1 : *c\direction % 2
                                          Mob()\direction + 1 : Mob()\direction %2
                                          Mob()\collide_time = ElapsedMilliseconds() + 250            
                                   EndIf 
                            EndIf 
                            
                     Next
                     PopListPosition(Mob())
                     
                     If Mob()\is_cool = #False 
                            ; mob / mario      
                            If entity_collide(@Mario,@Mob()) And Mario\is_die = #False 
                                   
                                   
                                   If Mario\y < Mob()\y 
                                          
                                          Mario\vy = -(Mario\jump_height/1.1)
                                          
                                          If Random(10) = 0
                                                 spawn_coin(Mob()\x,Mob()\y,(Mob()\direction+1)%2 )
                                          EndIf 
                                          
                                          Mario\score + ScoreDelta
                                          ScoreDelta * 2
                                          
                                          max_mob + 1
                                          If max_mob > 8
                                                 max_mob = 8
                                          EndIf 
                                          
                                          PlaySoundEX(sound_kill,#PB_Sound_MultiChannel)
                                          PlaySoundEX(sound_rejump,#PB_Sound_MultiChannel)
                                          
                                          If DeleteElement(Mob(),1) = 0
                                                 Break   
                                          EndIf 
                                          
                                   ElseIf Mario\y  >= Mob()\y And Mario\invincible = #False 
                                          Mario\vx = 0
                                          Mario\vy = 0
                                          Mario\is_die = #True 
                                          Mario\is_ghost = #True
                                          Mario\freeze_time = ElapsedMilliseconds() + 500
                                          Mario\use_physic = #False
                                          Mario\spriteid = 34
                                          Mario\life - 1
                                          
                                          PlaySoundEX(sound_hurt,#PB_Sound_MultiChannel)
                                          
                                          If Mario\life = 0
                                                 
                                                 spr = GrabSprite(#PB_Any,0,0,dw,dh)
                                                 UsePNGImageEncoder()
                                                 SaveSprite(spr,"MyScore.png",#PB_ImagePlugin_PNG)
                                                 
                                                 End
                                          EndIf
                                          
                                   EndIf 
                            EndIf 
                     EndIf 
                     update_physic(@Mob())
                     
                     
              Next
              
                     
             
              ; missile "physic..."
              ;
              ForEach Missile()
                     update_missile(@Missile())
                     
                            ; mISSILE / mario      
                            If entity_collide(@Mario, @Missile() ) And Mario\is_die = #False 
                                   
                                   
                                   If Mario\y < Missile()\y 
                                          
                                          Missile()\IsFalling = 1
                                          
                                          Mario\vy = -(Mario\jump_height/1.1)
                                          
                                          If Random(10) = 0
                                                 spawn_coin(Missile()\x,Missile()\y,(Missile()\direction+1)%2 )
                                          EndIf 
                                          
                                          Mario\score + ScoreDelta
                                          ScoreDelta * 2
                                          
                                   ElseIf Mario\y  >= Missile()\y And Mario\invincible = #False 
                                          Mario\vx = 0
                                          Mario\vy = 0
                                          Mario\is_die = #True 
                                          Mario\is_ghost = #True
                                          Mario\freeze_time = ElapsedMilliseconds() + 500
                                          Mario\use_physic = #False
                                          Mario\spriteid = 34
                                          Mario\life - 1
                                          
                                          PlaySoundEX(sound_hurt,#PB_Sound_MultiChannel)
                                          
                                          If Mario\life = 0
                                                 
                                                 spr = GrabSprite(#PB_Any,0,0,dw,dh)
                                                 UsePNGImageEncoder()
                                                 SaveSprite(spr,"MyScore.png",#PB_ImagePlugin_PNG)
                                                 
                                                 End
                                          EndIf
                                          
                                   EndIf 
                            EndIf 
                     
                     
                     
                     If(Missile()\x < -200 Or Missile()\x > 328) Or Missile()\y > 2048
                            DeleteElement(Missile())
                     EndIf
                     
                     
                     
                     
              Next 
              
              accumulator - (1.0/60.0)
       Wend 
       
       
       ;
       ;-DRAWING
       ;
       
       ClearScreen(RGB(26,28,44))
       
       ; draw mob
       ForEach(Mob())
              draw_entity(@Mob())  
       Next
       
       ForEach (Bonus())
              draw_entity(@Bonus())  
       Next
       
       
       ForEach Missile()
              draw_missile(@Missile())
       Next 
       
       ; draw tilemap
       For y = 0 To 15
              For x = 0 To 17
                     index = x + 19 * y
                     DisplayTransparentSprite( SubSprite(Tilemap( index )) ,x*8,y*8)
                     
                     ;       
              Next
       Next
       
       ; draw mario
       draw_entity(@Mario)
       
       ; draw score   
       draw_value( Mario\score, (64 - (((Len(Str(Mario\score))-1)*8)/2))+8 ,4)
       ; draw life
       For i = 0 To Mario\life-1
              DisplayTransparentSprite(SubSprite(35),8+(i*8),0)
       Next
       
       DisplayTransparentSprite(SubSprite(coin_id),(8+128)-8*4,0)
       offscreen = GrabSprite(#PB_Any,8,0,128,128)
       ClearScreen(0)
       factor.d = 128 / dh
       size.l = 128/factor
       ZoomSprite(offscreen,size,size)
       DisplayTransparentSprite(offscreen,(dw/2) - (size/2),(dh/2) - (size/2))
       ZoomSprite(offscreen,#PB_Default,#PB_Default)
       FlipBuffers()
Wend

CloseScreen()
End 



Procedure.l getcolor(rgb)
       For i = 0 To 15
              If Color(i) = rgb
                     ProcedureReturn i
              EndIf
       Next 
EndProcedure



Procedure draw_value(value.l,x,y)
       str$ = Str(value)  
       For i = 0 To Len(str$)-1
              n.l = Val(Mid(str$,i+1,1))
              DisplayTransparentSprite( SubSprite( 24 + n ) , x + (i * 6),y)
       Next
EndProcedure


Procedure check_solid(x.d, y.d)
       ProcedureReturn is_solid(Round(x/8,#PB_Round_Down),Round(y/8,#PB_Round_Down))
EndProcedure


Procedure is_solid(tilex,tiley)
       index = tilex + 19 * tiley
       If index >= 0 And index < (19*16)
              tile_id = Tilemap(index)
              For i = 0 To (?end_solid_tile - ?solid_tile) - 1
                     If tile_id = SolidTile(i)
                            ProcedureReturn #True
                     EndIf 
              Next
       EndIf 
       ProcedureReturn #False 
EndProcedure


Procedure spawn_mob()
       AddElement(Mob())
       
       
       Mob()\jump_height    = 1.0
       
       If Random(9) > 2 
              Mob()\anim_left_min  = 21
              Mob()\anim_left_max  = 22
              Mob()\anim_right_min = 21
              Mob()\anim_right_max = 22
              Mob()\animspeed      = 25
              Mob()\jumper         = #True 
              Mob()\jump_delay     = 250
       Else 
              Mob()\anim_left_min  = 6
              Mob()\anim_left_max  = 8
              Mob()\anim_right_min = 6
              Mob()\anim_right_max = 8
              Mob()\animspeed      = 100
              Mob()\jumper         = #False
       EndIf 
       
       
       Mob()\gravity        = 0.1  
       Mob()\direction = Random(1)
       Mob()\use_physic = #False
       Mob()\entry_mode = 1
       Mob()\is_ghost = #False 
       Mob()\is_cool = #False 
       Mob()\wrap = #True 
       
       If Mob()\direction = 1
              Mob()\x  = 1*8
              Mob()\y  = 1*8
       Else
              Mob()\x  = 16*8 
              Mob()\y  = 1*8
       EndIf
       
       
EndProcedure


Procedure spawn_coin(x,y,direction)
       AddElement(Bonus())
       
       Bonus()\jumping = #True 
       Bonus()\jump_height    = 0.5
       
       Bonus()\anim_left_min  = 15
       Bonus()\anim_left_max  = 17
       Bonus()\anim_right_min = 15
       Bonus()\anim_right_max = 17
       Bonus()\animspeed      = 25
       
       Bonus()\gravity        = 0.05
       Bonus()\use_physic = #True
       Bonus()\is_ghost = #False 
       Bonus()\wrap = #True
       Bonus()\x  = x
       Bonus()\y  = y
       Bonus()\direction = direction
       Bonus()\uncollect_time = ElapsedMilliseconds() + 100
       If Bonus()\direction = 1
              Bonus()\vx = 0.5
              Bonus()\vy = -1.0
       Else
              Bonus()\vx = -0.5
              Bonus()\vy = -1.0
       EndIf
       
EndProcedure


Procedure spawn_missile(y)
       AddElement(Missile())
       
       Missile()\use_physic = #False 
       Missile()\direction = Random(1)
       
       If  Missile()\direction
              Missile()\x = - 16
              Missile()\y = y * 8
              Missile()\vx = 1
       Else
              Missile()\x = 128 
              Missile()\y = y * 8
              Missile()\vx = -1
       EndIf
       
       
       
       
EndProcedure

Procedure draw_missile(*m.Missile)
       
       If  Missile()\direction
              DisplayTransparentSprite( SubSprite(9) , *m\x, *m\y) ; tail
              DisplayTransparentSprite( SubSprite(4) , *m\x + 8, *m\y) ; head
       Else
              DisplayTransparentSprite( SubSprite(10) , *m\x+8, *m\y) ; tail
              DisplayTransparentSprite( SubSprite(11) , *m\x, *m\y)   ; head    
       EndIf
       
       
       
       
EndProcedure

Procedure update_missile(*m.missile)
       If *m\IsFalling
              *m\vx = 0
              *m\vy + 0.2
       EndIf       
       *m\x + *m\vx  
       *m\y + *m\vy
EndProcedure

Procedure draw_entity(*e.entity)
       
       If *e\vx <> 0 And *e\is_ghost = #False 
              
              If ( *e\animtime < ElapsedMilliseconds() )
                     *e\animtime = ElapsedMilliseconds() + *e\animspeed
                     *e\spriteid+1
                     
                     If *e\flipme = #False   
                            If *e\spriteid < *e\anim_right_min : *e\spriteid = *e\anim_right_min : EndIf
                            If *e\spriteid > *e\anim_right_max
                                   *e\spriteid = *e\anim_right_min
                            EndIf       
                     Else 
                            If *e\spriteid < *e\anim_left_max : *e\spriteid = *e\anim_left_max : EndIf
                            If *e\spriteid > *e\anim_left_max
                                   *e\spriteid = *e\anim_left_min
                            EndIf
                     EndIf 
                     
              EndIf
              
       ElseIf *e\vx = 0 And *e\is_ghost = #False 
              If *e\flipme = #False 
                     *e\spriteid = *e\anim_right_min
              Else
                     *e\spriteid = *e\anim_left_min
              EndIf 
       EndIf
       
       If *e\blink = 1 
              DisplayTransparentSprite( SubSprite(0) , *e\x, *e\y)
       Else
              DisplayTransparentSprite( SubSprite(*e\spriteid) , *e\x, *e\y)
       EndIf
       
EndProcedure



Procedure update_physic(*e.Entity)
       
       If *e\use_physic
              
              
              ; side collision
              If check_solid( *e\x + *e\vx, *e\y + *e\vy) Or check_solid( *e\x + 7 + *e\vx, *e\y + *e\vy) Or check_solid( *e\x + 7 + *e\vx, *e\y + 7 + *e\vy) Or check_solid( *e\x + *e\vx, *e\y + 7 + *e\vy)
                     *e\vx = 0
              EndIf 
              
              ; collision down
              If (check_solid( *e\x , *e\y + 8 + *e\vy) Or check_solid( *e\x + 7 , *e\y + 8 + *e\vy)) And *e\is_ghost = #False 
                     *e\vy = 0
                     *e\onground = #True
                     If *e = @Mario
                            ScoreDelta = 50
                     EndIf

              Else
                     *e\vy = *e\vy + *e\gravity ; falling
                     *e\onground = #False
              EndIf 
              
              ; jumping
              If *e\jumping = #True And *e\onground = #True
                     *e\vy = -*e\jump_height
                     *e\onground = #False 
              EndIf 
              
              ; collision top
              If ((check_solid( *e\x + *e\vx, *e\y + *e\vy) Or check_solid( *e\x + 7 + *e\vx, *e\y + *e\vy)) And *e\vy < 0) And *e\is_ghost = #False 
                     *e\vy = 0  
              EndIf 
              
              
              ; wraping   
              If *e\wrap = #True 
                     If *e\x < -1   : *e\x = 144 - 8 : EndIf
                     If *e\x > 17*8  : *e\x = 1      : EndIf 
              Else
                     If *e\x < -1    : *e\deleteme = #True  : EndIf
                     If *e\x > 17*8  : *e\deleteme = #True  : EndIf 
              EndIf 
              
              ; lock velocity
              If *e\vx > 1.0 : *e\vx = 1.0: EndIf
              If *e\vx <-1.0 : *e\vx = -1.0 : EndIf
              
              ; update position
              *e\x = *e\x + *e\vx 
              *e\y = *e\y + *e\vy
       EndIf
       
EndProcedure

Procedure entity_collide(*a.Entity, *b.Entity)
       If (*b\x > = *a\x + 8) Or (*b\x + 8 <= *a\x) Or (*b\y > = *a\y + 8) Or  (*b\y + 8 <= *a\y)
              ProcedureReturn #False 
       Else
              ProcedureReturn #True 
       EndIf 
EndProcedure

Procedure entity_collide_point(*e.Entity, x.f, y.f, velocity.b = #False)
       
       If velocity = #False 
              If x >= *e\x  And x < *e\x + 7 And y >= *e\y  And y < *e\y + 7
                     ProcedureReturn #True 
              Else
                     ProcedureReturn #False  
              EndIf  
       Else 
              If x >= *e\x + *e\vx  And x < *e\x + 7 + *e\vx And y >= *e\y + *e\vy  And y < *e\y + 7 + *e\vy
                     ProcedureReturn #True 
              Else
                     ProcedureReturn #False  
              EndIf
       EndIf 
EndProcedure


;-Datasection
DataSection
       palette:
       Data.l 16711935,2890778,6104925,5455537,5733871,7720447,7401639,6600504,7958821,7288361,13196603,16164417,16248691,16053492,12759188,8809558,5717043
       end_palette:
       
       
       
       tilemap:  
       Data.b  0, 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
       Data.b  0, 3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  5,  0,  0 
       Data.b  0, 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
       Data.b  2, 2,  2,  2,  2,  2,  2,  2,  0,  0,  2,  2,  2,  2,  2,  2,  2,  2,  2 
       Data.b  0, 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
       Data.b  0, 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
       Data.b  0, 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
       Data.b  2, 2,  2,  0,  0,  0,  2,  2,  2,  2,  2,  2,  0,  0,  0,  2,  2,  2,  2
       Data.b  0, 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
       Data.b  0, 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
       Data.b  0, 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
       Data.b  2, 2,  2,  2,  2,  2,  2,  0,  0,  0,  0,  2,  2,  2,  2,  2,  2,  2,  2
       Data.b  0, 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
       Data.b  0, 3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  5,  0,  0
       Data.b  0, 0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0
       Data.b  1, 1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1
       
       
       end_tilemap:
       
       
       texture:
       Data.b 	0	,0	,0	,0	,0	,0	,0	,0	,1	,1	,1	,1	,1	,1	,1	,1	,12	,12	,12	,12	,12	,12	,12	,12	,1	,1	,1	,1	,1	,6	,6	,13	,0	,0	,0	,0	,0	,0	,0	,0	,6	,6	,13	,1	,1	,1	,1	,1	
       Data.b 	0	,0	,0	,0	,0	,0	,0	,0	,1	,3	,4	,4	,4	,5	,5	,5	,10	,12	,12	,12	,12	,12	,12	,11	,6	,6	,6	,6	,8	,7	,13	,13	,13	,13	,13	,0	,0	,0	,0	,0	,7	,13	,13	,8	,6	,6	,6	,6	
       Data.b 	0	,0	,0	,0	,0	,0	,0	,0	,1	,2	,3	,3	,3	,3	,3	,4	,10	,10	,12	,12	,12	,12	,11	,11	,13	,13	,13	,13	,8	,7	,7	,13	,14	,14	,0	,0	,0	,13	,0	,0	,7	,7	,13	,8	,13	,13	,13	,13	
       Data.b 	0	,0	,0	,0	,0	,0	,0	,0	,1	,2	,2	,3	,3	,3	,3	,3	,10	,10	,10	,12	,12	,11	,11	,11	,7	,7	,7	,7	,8	,7	,7	,13	,0	,0	,0	,0	,13	,13	,1	,0	,7	,7	,13	,8	,7	,7	,7	,7	
       Data.b 	0	,0	,0	,0	,0	,0	,0	,0	,1	,1	,1	,1	,1	,1	,1	,1	,10	,10	,10	,9	,11	,11	,11	,11	,9	,9	,9	,9	,9	,7	,7	,13	,0	,14	,0	,0	,13	,13	,13	,9	,7	,7	,13	,9	,9	,9	,9	,9	
       Data.b 	0	,0	,0	,0	,0	,0	,0	,0	,4	,5	,5	,5	,1	,3	,4	,4	,10	,10	,9	,9	,9	,11	,11	,11	,9	,9	,9	,9	,9	,8	,9	,7	,13	,13	,14	,9	,9	,9	,9	,10	,8	,9	,7	,9	,9	,9	,9	,9	
       Data.b 	0	,0	,0	,0	,0	,0	,0	,0	,3	,3	,3	,4	,1	,2	,3	,3	,10	,9	,9	,9	,9	,9	,11	,11	,10	,10	,10	,10	,9	,10	,9	,8	,14	,14	,9	,9	,9	,10	,10	,0	,10	,9	,8	,9	,10	,10	,10	,10	
       Data.b 	0	,0	,0	,0	,0	,0	,0	,0	,3	,3	,3	,3	,1	,2	,2	,3	,9	,9	,9	,9	,9	,9	,9	,11	,1	,1	,1	,1	,1	,10	,10	,10	,10	,10	,10	,10	,10	,0	,0	,0	,10	,10	,10	,1	,1	,1	,1	,1	
       Data.b 	0	,0	,4	,5	,13	,5	,0	,0	,0	,0	,4	,5	,13	,5	,0	,0	,0	,0	,4	,5	,13	,5	,0	,0	,0	,0	,0	,0	,0	,0	,0	,0	,0	,0	,0	,0	,0	,0	,0	,0	,0	,0	,0	,0	,0	,0	,0	,0	
       Data.b 	9	,9	,5	,4	,4	,2	,9	,9	,9	,9	,5	,4	,4	,2	,9	,9	,9	,9	,5	,4	,4	,2	,9	,9	,13	,13	,0	,0	,13	,13	,13	,13	,13	,13	,13	,13	,0	,0	,13	,13	,0	,0	,0	,0	,0	,13	,13	,13	
       Data.b 	4	,13	,9	,5	,2	,9	,13	,5	,4	,13	,9	,5	,2	,9	,13	,5	,4	,13	,9	,5	,2	,9	,13	,5	,14	,14	,13	,0	,14	,14	,14	,14	,14	,14	,14	,14	,0	,13	,14	,14	,0	,0	,13	,0	,0	,0	,14	,14	
       Data.b 	4	,13	,13	,9	,9	,13	,13	,5	,4	,13	,13	,9	,9	,13	,13	,5	,4	,13	,13	,9	,9	,13	,13	,5	,0	,0	,14	,0	,0	,0	,0	,0	,0	,0	,0	,0	,0	,14	,0	,0	,0	,1	,13	,13	,0	,0	,0	,0	
       Data.b 	4	,13	,1	,4	,4	,1	,13	,4	,4	,13	,1	,4	,4	,1	,13	,4	,4	,13	,1	,4	,4	,1	,13	,4	,0	,0	,9	,0	,0	,0	,14	,13	,13	,14	,0	,0	,0	,9	,0	,0	,9	,13	,13	,13	,0	,0	,14	,0	
       Data.b 	2	,4	,4	,4	,4	,4	,4	,4	,2	,4	,4	,4	,4	,4	,10	,9	,9	,10	,4	,4	,4	,4	,4	,4	,9	,9	,9	,9	,9	,9	,14	,13	,13	,14	,9	,9	,9	,9	,9	,9	,10	,9	,9	,9	,9	,14	,13	,13	
       Data.b 	10	,2	,14	,14	,14	,14	,2	,10	,0	,2	,14	,14	,14	,10	,9	,9	,9	,9	,10	,14	,14	,14	,2	,0	,9	,9	,10	,9	,9	,9	,9	,14	,14	,9	,9	,9	,9	,10	,9	,9	,0	,10	,10	,9	,9	,9	,14	,14	
       Data.b 	9	,10	,0	,14	,14	,0	,10	,9	,0	,9	,10	,14	,14	,9	,9	,0	,0	,9	,9	,14	,14	,10	,9	,0	,10	,10	,0	,10	,10	,10	,10	,10	,10	,10	,10	,10	,10	,0	,10	,10	,0	,0	,0	,10	,10	,10	,10	,10	
       Data.b 	0	,0	,0	,3	,3	,3	,13	,0	,0	,0	,0	,3	,3	,3	,13	,0	,0	,0	,0	,3	,3	,3	,13	,0	,0	,0	,0	,0	,0	,0	,0	,0	,0	,0	,0	,0	,0	,0	,0	,0	,0	,0	,0	,0	,0	,0	,0	,0	
       Data.b 	0	,0	,0	,3	,3	,3	,3	,3	,0	,0	,0	,3	,3	,3	,3	,3	,0	,0	,0	,3	,3	,3	,3	,3	,0	,0	,0	,0	,0	,0	,0	,0	,0	,0	,0	,0	,0	,0	,0	,0	,0	,0	,0	,0	,0	,0	,0	,0	
       Data.b 	0	,0	,2	,4	,2	,1	,4	,0	,0	,0	,2	,4	,2	,1	,4	,0	,0	,0	,2	,4	,2	,1	,4	,0	,0	,0	,0	,5	,13	,0	,0	,0	,0	,0	,0	,13	,13	,0	,0	,0	,0	,0	,0	,13	,13	,0	,0	,0	
       Data.b 	0	,0	,2	,4	,4	,2	,2	,4	,0	,0	,2	,4	,4	,2	,2	,4	,0	,0	,2	,4	,4	,2	,2	,4	,0	,0	,5	,4	,4	,13	,0	,0	,0	,0	,0	,4	,13	,0	,0	,0	,0	,0	,0	,5	,5	,0	,0	,0	
       Data.b 	0	,0	,0	,0	,4	,4	,4	,0	,0	,0	,0	,0	,4	,4	,4	,0	,0	,0	,0	,0	,4	,4	,4	,0	,0	,3	,4	,4	,4	,4	,13	,0	,0	,0	,2	,4	,4	,13	,0	,0	,0	,0	,0	,4	,4	,0	,0	,0	
       Data.b 	0	,3	,3	,5	,11	,10	,2	,0	,0	,0	,3	,5	,11	,10	,2	,0	,0	,0	,0	,3	,5	,11	,1	,0	,0	,2	,3	,4	,4	,4	,5	,0	,0	,0	,2	,3	,4	,5	,0	,0	,0	,0	,0	,4	,4	,0	,0	,0	
       Data.b 	13	,0	,11	,11	,10	,10	,0	,14	,0	,13	,11	,11	,11	,10	,14	,0	,0	,0	,0	,3	,13	,11	,0	,0	,0	,0	,2	,3	,4	,5	,0	,0	,0	,0	,0	,2	,3	,0	,0	,0	,0	,0	,0	,3	,3	,0	,0	,0	
       Data.b 	0	,0	,2	,0	,0	,0	,2	,0	,0	,0	,0	,2	,0	,2	,0	,0	,0	,0	,0	,0	,2	,0	,0	,0	,0	,0	,0	,2	,3	,0	,0	,0	,0	,0	,0	,2	,2	,0	,0	,0	,0	,0	,0	,2	,2	,0	,0	,0	
       Data.b 	0	,13	,3	,3	,3	,0	,0	,0	,0	,13	,3	,3	,3	,0	,0	,0	,0	,13	,3	,3	,3	,0	,0	,0	,0	,3	,3	,0	,0	,3	,3	,0	,3	,3	,3	,0	,0	,3	,3	,3	,0	,0	,0	,0	,0	,0	,0	,0	
       Data.b 	3	,3	,3	,3	,3	,0	,0	,0	,3	,3	,3	,3	,3	,0	,0	,0	,3	,3	,3	,3	,3	,0	,0	,0	,3	,0	,0	,0	,0	,0	,0	,3	,3	,2	,2	,0	,0	,2	,2	,3	,0	,0	,0	,0	,0	,0	,0	,0	
       Data.b 	0	,4	,1	,2	,4	,2	,0	,0	,0	,4	,1	,2	,4	,2	,0	,0	,0	,4	,1	,2	,4	,2	,0	,0	,3	,2	,2	,0	,0	,2	,2	,3	,3	,0	,0	,0	,0	,0	,0	,3	,0	,0	,0	,0	,0	,0	,0	,0	
       Data.b 	4	,2	,2	,4	,4	,2	,0	,0	,4	,2	,2	,4	,4	,2	,0	,0	,4	,2	,2	,4	,4	,2	,0	,0	,3	,14	,14	,4	,4	,14	,14	,3	,3	,14	,14	,4	,4	,14	,14	,3	,0	,0	,0	,0	,0	,0	,0	,0	
       Data.b 	0	,4	,4	,4	,0	,0	,0	,0	,0	,4	,4	,4	,0	,0	,0	,0	,0	,4	,4	,4	,0	,0	,0	,0	,2	,13	,9	,3	,3	,9	,13	,2	,2	,13	,9	,3	,3	,9	,13	,2	,0	,0	,0	,0	,0	,0	,0	,0	
       Data.b 	0	,2	,10	,11	,5	,3	,3	,0	,0	,2	,10	,11	,5	,3	,0	,0	,0	,1	,11	,5	,3	,0	,0	,0	,0	,2	,3	,3	,3	,3	,3	,0	,0	,2	,3	,3	,3	,3	,3	,0	,0	,0	,0	,0	,0	,0	,0	,0	
       Data.b 	14	,0	,10	,10	,11	,11	,0	,13	,0	,14	,10	,11	,11	,11	,13	,0	,0	,0	,11	,13	,3	,0	,0	,0	,0	,13	,2	,0	,2	,3	,13	,0	,0	,13	,2	,3	,3	,3	,13	,0	,0	,0	,0	,0	,0	,0	,0	,0	
       Data.b 	0	,2	,0	,0	,0	,2	,0	,0	,0	,0	,2	,0	,2	,0	,0	,0	,0	,0	,0	,2	,0	,0	,0	,0	,0	,13	,0	,0	,13	,0	,13	,0	,0	,0	,0	,13	,0	,0	,0	,0	,0	,0	,0	,0	,0	,0	,0	,0	
       Data.b 	0	,0	,13	,13	,13	,0	,0	,0	,0	,0	,0	,13	,0	,0	,0	,0	,0	,0	,13	,13	,13	,0	,0	,0	,0	,0	,13	,13	,13	,0	,0	,0	,0	,13	,0	,0	,0	,0	,0	,0	,0	,13	,13	,13	,13	,13	,0	,0	
       Data.b 	0	,13	,1	,1	,1	,13	,0	,0	,0	,0	,13	,13	,1	,0	,0	,0	,0	,13	,1	,1	,1	,13	,0	,0	,0	,13	,1	,1	,1	,13	,0	,0	,0	,13	,1	,0	,13	,0	,0	,0	,0	,13	,1	,1	,1	,1	,1	,0	
       Data.b 	0	,13	,0	,0	,0	,13	,1	,0	,0	,13	,1	,13	,1	,0	,0	,0	,0	,1	,1	,0	,0	,13	,1	,0	,0	,1	,1	,0	,0	,13	,1	,0	,0	,13	,1	,0	,13	,1	,0	,0	,0	,13	,1	,0	,0	,0	,0	,0	
       Data.b 	0	,13	,0	,0	,0	,13	,1	,0	,0	,1	,1	,13	,1	,0	,0	,0	,0	,0	,0	,13	,13	,1	,1	,0	,0	,0	,0	,13	,13	,1	,1	,0	,0	,13	,13	,13	,13	,13	,0	,0	,0	,13	,13	,13	,13	,13	,0	,0	
       Data.b 	0	,13	,0	,0	,0	,13	,1	,0	,0	,0	,0	,13	,1	,0	,0	,0	,0	,0	,13	,1	,1	,1	,0	,0	,0	,0	,0	,1	,1	,13	,0	,0	,0	,1	,1	,1	,13	,1	,1	,0	,0	,1	,1	,1	,1	,13	,1	,0	
       Data.b 	0	,13	,0	,0	,0	,13	,1	,0	,0	,0	,0	,13	,1	,0	,0	,0	,0	,13	,1	,1	,0	,0	,0	,0	,0	,13	,0	,0	,0	,13	,1	,0	,0	,0	,0	,0	,13	,1	,0	,0	,0	,0	,0	,0	,0	,13	,1	,0	
       Data.b 	0	,1	,13	,13	,13	,1	,1	,0	,0	,0	,13	,13	,13	,0	,0	,0	,0	,13	,13	,13	,13	,13	,0	,0	,0	,1	,13	,13	,13	,1	,1	,0	,0	,0	,0	,0	,13	,1	,0	,0	,0	,13	,13	,13	,13	,13	,1	,0	
       Data.b 	0	,0	,1	,1	,1	,1	,0	,0	,0	,0	,1	,1	,1	,1	,0	,0	,0	,1	,1	,1	,1	,1	,1	,0	,0	,0	,1	,1	,1	,1	,0	,0	,0	,0	,0	,0	,1	,1	,0	,0	,0	,1	,1	,1	,1	,1	,1	,0	
       Data.b 	0	,0	,13	,13	,13	,0	,0	,0	,0	,13	,13	,13	,13	,13	,0	,0	,0	,0	,13	,13	,13	,0	,0	,0	,0	,0	,13	,13	,13	,0	,0	,0	,0	,0	,3	,13	,13	,3	,0	,0	,0	,0	,1	,1	,1	,1	,0	,0	
       Data.b 	0	,13	,1	,1	,1	,13	,0	,0	,0	,1	,1	,1	,1	,13	,1	,0	,0	,13	,1	,1	,1	,13	,0	,0	,0	,13	,1	,1	,1	,13	,0	,0	,0	,0	,3	,3	,3	,3	,0	,0	,0	,1	,3	,13	,13	,3	,1	,0	
       Data.b 	0	,13	,1	,0	,0	,1	,1	,0	,0	,0	,0	,0	,13	,1	,1	,0	,0	,13	,0	,0	,0	,13	,1	,0	,0	,13	,0	,0	,0	,13	,1	,0	,0	,2	,1	,4	,4	,1	,2	,0	,0	,1	,3	,3	,3	,3	,1	,0	
       Data.b 	0	,13	,13	,13	,13	,0	,0	,0	,0	,0	,0	,0	,13	,1	,0	,0	,0	,1	,13	,13	,13	,1	,1	,0	,0	,1	,13	,13	,13	,13	,1	,0	,0	,4	,2	,2	,2	,2	,4	,0	,1	,2	,1	,4	,4	,1	,2	,1	
       Data.b 	0	,13	,1	,1	,1	,13	,0	,0	,0	,0	,0	,13	,1	,1	,0	,0	,0	,13	,1	,1	,1	,13	,0	,0	,0	,0	,1	,1	,1	,13	,1	,0	,13	,0	,4	,1	,1	,4	,0	,13	,1	,4	,2	,2	,2	,2	,4	,1	
       Data.b 	0	,13	,0	,0	,0	,13	,1	,0	,0	,0	,0	,13	,1	,0	,0	,0	,0	,13	,0	,0	,0	,13	,1	,0	,0	,13	,0	,0	,0	,13	,1	,0	,0	,3	,5	,11	,11	,5	,3	,0	,0	,1	,4	,4	,4	,4	,1	,0	
       Data.b 	0	,1	,13	,13	,13	,1	,1	,0	,0	,0	,13	,1	,1	,0	,0	,0	,0	,1	,13	,13	,13	,1	,1	,0	,0	,1	,13	,13	,13	,1	,1	,0	,0	,0	,10	,10	,10	,10	,0	,0	,0	,0	,1	,1	,1	,1	,0	,0	
       Data.b 	0	,0	,1	,1	,1	,1	,0	,0	,0	,0	,1	,1	,0	,0	,0	,0	,0	,0	,1	,1	,1	,1	,0	,0	,0	,0	,1	,1	,1	,1	,0	,0	,0	,2	,0	,0	,0	,0	,2	,0	,0	,0	,0	,0	,0	,0	,0	,0	
       end_texture:
       
       solid_tile:
       Data.b 1,2
       end_solid_tile:
       
       
       bin_sound_jump:
       ;  IncludeBinary "jump.wav"
       bin_sound_jump_e:
       
       bin_sound_hurt:
       ;  IncludeBinary "hurt.wav"
       bin_sound_hurt_e:
       
       bin_sound_kill:
       ;  IncludeBinary "kill.wav"
       bin_sound_kill_e:
       
       bin_sound_coin:
       ;  IncludeBinary "coin.wav"
       bin_sound_coin_e:
       
       bin_sound_falling:
       ;  IncludeBinary "falling.wav"
       bin_sound_falling_e:
       
       bin_sound_respawn:
       ;  IncludeBinary "respawn.wav"
       bin_sound_respawn_e:
       
       bin_sound_rejump:
       ;  IncludeBinary "rejump.wav"
       bin_sound_rejump_e:
       
       bin_sound_missile:
       ;  IncludeBinary "missile.wav"
       bin_sound_missile_e:
       
       bin_sound_extralife:
       ;  IncludeBinary "extralife.wav"
       bin_sound_extralife_e:
       
       
       
EndDataSection


Re: Petit remake d'un Mario sur Atari 7800

Publié : sam. 04/avr./2020 7:41
par Micoute
Il faut vraiment être un mordu pour se taper à la main, car je ne crois pas que ce soit du copier-coller, tout ce listing, bien entendu tout n'a pas été tapé le même jour, mais c'est quand même un travail ardu, je dis bravo à tous ceux qui ont cet esprit, sans oublier de dire merci beaucoup.

Re: Petit remake d'un Mario sur Atari 7800

Publié : sam. 04/avr./2020 7:53
par Ollivier
@G-Rom

J'ai modifié/rajouté 3 trucs.

1) Le wrap des pièces : à la longue, ça fait un "porte-monnaie" qui nage dans le niveau du bas !
MeO : Extrêmement simple à faire (changement de variable)

2) Le score double (50+100+200+ etc...) si l'on enchaîne les sauts sur les ennemis ou les obus sans toucher le sol.
MeO : J'ai "péché" en utilisant une variable globale. Et j'ai été copier une condition déjà existante donc pas très compliqué.

3) Les obus sont vulnérables et donnent des points.
MeO : Copie simple de tout un bloc conditionnelle.


Des modifs sont simples à faire donc qualité de code vraiment élevée malgré les apparences. Juste quelques noms de variable qui font tiquer un peu, mais pas important.

Ces nouvelles règles pimentent un peu le jeu solo : 10000 points assez facilement.

(-) Le son n'a pas été mis à jour
(-) J'ai merdouillé pour uploader le code : Si un modo pouvait jeter un oeil, c'est juste des lignes à recoller... Et le résultat est évidemment ludique.

A part cette histoire de mémoire qui semble se remplir : je n'ai pas réussi à trouver l'erreur dans la lib des collisions. C'est peut-être pour ça que tu souhaitais dépoussiérer cette lib 2D. Si c'est aussi pour éviter de saturer la mémoire avec la gestion interne des collisions, évidemment ça ne sera que bénéfique.

Merci beaucoup pour ce partage.




@Micoute

Euh si si Micoute : c'est forcément du copier/coller : j'y serai encore pour un bout de temps sinon...
Excuse je t'ai soufflé un peu. Et prends soin de toi (exigence absolue des visites)

Re: Petit remake d'un Mario sur Atari 7800

Publié : sam. 04/avr./2020 14:07
par G-Rom
Super Ollivier ! tu as fait cela sur ton smartphone ?

Re: Petit remake d'un Mario sur Atari 7800

Publié : sam. 04/avr./2020 15:25
par Ollivier
Non impossible ! Ça aurait une prouesse titanesque : au moins chez Samsung, c'est du strict foutage de goule les mises à jour sur Smartphone. J'ai réussi à recharger la batterie d'un PC et j'ai modifié en fonction du GamePlay que je connaissais sur NES (Mario 3 à 2 joueurs). Déjà, ça marche en 5.50 X64 mais il y a un tampon mémoire qui ne s'efface pas quelquepart...