Jump to content

Photo

Get Papi ! A first Try with the Intellivision ! :)


68 replies to this topic

#1 Vetea OFFLINE  

Vetea

    Chopper Commander

  • 227 posts
  • Location:France

Posted Sun Nov 4, 2018 12:55 PM

Hello here,

 

I'm the creator of Papi Commando, you can find my games on my Itch.io here :

https://vetea.itch.io

 

A friend of Gamopat's Forum talks me about a SDK, IntyBasic to make games with the Intellivision.

Curious, I'm start to make a Game/Tuto with this new SDK for me ...

 

This new game calls : Get Papi !!! :D

 

Sans_titre.png?width=399&height=300

 

The rules is simple, try to survive against the C++ BOT, the C3P-128 hunting bot.

A special Gameplay feature has been done, when a bot touch another one, their Hunting mode is OFF ! ;)

It's a survival game for now ...

 

But when I would be better with IntyBasic, this game will be improved. ;)

 

A video :

 

You can DL the project to compile with the Attach Files.

 

Have fun with Papi !! :D

Cheers,

Vetea

 

 

Attached Files


Edited by Vetea, Sun Nov 4, 2018 1:34 PM.


#2 Vetea OFFLINE  

Vetea

    Chopper Commander

  • Topic Starter
  • 227 posts
  • Location:France

Posted Sun Nov 4, 2018 2:36 PM

Here is the ROM ! 

Actually, the v1.2 version. ;)

 

Attached Files



#3 DZ-Jay ONLINE  

DZ-Jay

    Quadrunner

  • 11,488 posts
  • The P-Machinery AGE is almost here!
  • Location:NC, USA

Posted Sun Nov 4, 2018 2:43 PM

Interesting game.  The sprites move smoothly and the controls seem responsive.  I just wished it did more.  I can't wait to see what else you do with it. :thumbsup:

 

    -dZ.



#4 drludos OFFLINE  

drludos

    Space Invader

  • 16 posts

Posted Sun Nov 4, 2018 3:01 PM

Awesome! I'm impressed on how quickly you can pick up a new machine and release a game on it!

 

This is a very good start, I'm looking forward the next versions!



#5 Vetea OFFLINE  

Vetea

    Chopper Commander

  • Topic Starter
  • 227 posts
  • Location:France

Posted Sun Nov 4, 2018 4:01 PM

Thanks for your comments ! :)

 

Hey DrLudos !!

Glad to meet you here and gratz for your new Atari2600 games. ;)

 

For sure, I improve this little game as my Intellivion's Skills. ^^

Cheers,

Vetea



#6 grips03 OFFLINE  

grips03

    River Patroller

  • 3,697 posts
  • Location:New England

Posted Sun Nov 4, 2018 7:00 PM

Great to see more programmers making games.



#7 mr_me OFFLINE  

mr_me

    River Patroller

  • 3,523 posts
  • Location:Ontario

Posted Mon Nov 5, 2018 8:33 AM

I like the sprite graphics and animation; and those are low resolution sprites. Just a reminder that intellivision has higher resolution 8x16 sprites using what we call half-pixels.

Edited by mr_me, Mon Nov 5, 2018 8:34 AM.


#8 grips03 OFFLINE  

grips03

    River Patroller

  • 3,697 posts
  • Location:New England

Posted Mon Nov 5, 2018 12:44 PM

Vetea,

Did you ever play GI Joe on Commodore 64.  There is a part of the game where Cobra faces GI Joe in one on one battle in various locations (city, snow/forest, cobra HQ, desert).  This part of the game can be:

human vs. human

or

human vs. computer. 

 

Could Intellivision do something like that?

 

 

Time 0:43 to 1:45 to see city battle. 



#9 Vetea OFFLINE  

Vetea

    Chopper Commander

  • Topic Starter
  • 227 posts
  • Location:France

Posted Mon Nov 5, 2018 4:44 PM

Hello !!

 

Today, I improve and learn some Intellivision Species as Collision TILE/Sprite, #backtab gestion, GRAM Gestion, etc ...

 

 

As you see, it's a nice ARENA ! Like a mini Bomberman. Hehe.

But I have some Collision Problem when a TILE is near another one, like 8 px of free place, Sprite is blocked.

I have to fix that.

 

I can anime TILE as the Background here.

The IA has to be improved too, like a PAC MAN style, but each Robot will have his own IA.

 

Cheers,

 

Vetea

 

 



#10 intellivotion ONLINE  

intellivotion

    Intellivoted

  • 2,736 posts
  • Time Zone Traveller
  • Location:Italy... sometimes

Posted Mon Nov 5, 2018 5:41 PM

The villains move and look like Walking Dead. What about an horror version of the game? Intellivision doesn't have horror games other than Dracula

#11 Vetea OFFLINE  

Vetea

    Chopper Commander

  • Topic Starter
  • 227 posts
  • Location:France

Posted Tue Nov 6, 2018 2:10 AM

Hey intellivotion !!
It's a good suggestion ! I like Zombbiiiis in game ( Braiiiin ), I add them on my own PC/MD Game as Papi Commando and others.
The vilain are Robots, but we can imagine them like Zomb's Bots too. ;)
I'm a pixel artist, so I can modify the design.

The only problem is to fix this collision bug when a tile is near another one ( 8 px ), it blocks sprites ... But I will find ! :D

I want to do a complete game. I work too on a MD game ( Papi Tennis ) and a SNES Game ( Papi Reload with a friend ) ... But I really like tge possibilities of this console .. The Hardware is really nice, and the SDK awesome !!
I like this low Res too, the 16 Colors are nice to do nice Gfx ...

Really when you make games in this old hardware, you have to find again and again the good gameplay compared with the lack of power ... We are not doing RDR2 !! Hehe.

Cheers,

Vetea

#12 DZ-Jay ONLINE  

DZ-Jay

    Quadrunner

  • 11,488 posts
  • The P-Machinery AGE is almost here!
  • Location:NC, USA

Posted Tue Nov 6, 2018 3:26 AM

What's the problem with the collisions?  Post some code and we may be able to help.  Also, you may want to post it in the programming forum.  There's plenty of helpful people there willing to assist.

 

We also have cookies. :)

 

     -dZ.



#13 Vetea OFFLINE  

Vetea

    Chopper Commander

  • Topic Starter
  • 227 posts
  • Location:France

Posted Tue Nov 6, 2018 3:43 AM

Hey dZ !

Thanks for your future help and other grateful people. :)

 

Here is some code here ( I'm at work .. don't have the full code version. )

'Déclaration Sprites/TILE
   WAIT
   DEFINE DEF00,4,SpritePapiDROITE_0
   WAIT
   DEFINE DEF04,3,SpriteIADroite
   WAIT
   DEFINE DEF07,3,SpriteIABAS
   WAIT
   DEFINE DEF10,3,SpriteIAHAUT
   wait
   DEFINE 13,10,TilesDecor
   WAIT
   
   'Constantes
   CONST MUR_H=$0800+13*8 'Adresse Ecran $0800 + Couleur. Ici NOIR = 0 + Position GRAM * 8 ( TILE 8x8)
   CONST MUR_B=$0800+14*8
   CONST MUR_D=$0800+15*8
   CONST MUR_G=$0800+16*8
   CONST SOL = $0804+17*8   
   CONST MUR = $0800+18*8
   CONST SOL1= $0804+19*8
   
   'Constante Collision Objets
   CONST COL_MURH=BG13 
   CONST COL_MURB=BG14
   CONST COL_MURD=BG15
   CONST COL_MURG=BG16
   CONST COL_MUR= BG18

Test_Collision: PROCEDURE
   'Offset Coordonnée
   if UNIT=0 then #offset = x/8+y/8*20 else #offset = xIA/8+yIA/8*20
   COLI=0

   'Test au 4 coins des objets.
   #c  = PEEK($01FF+#offset)
   #c1 = PEEK($0200+#offset)
   #c2 = PEEK($01EC+#offset)
   #c3 = PEEK($01EB+#offset)
   'Test avec les éléments du tableau.
   if (#c=COL_MURH or #c1=COL_MURH or #c2=COL_MURH or #c3=COL_MURH) and #c<>0 then COLI=1:return
   if (#c=COL_MURB or #c1=COL_MURB or #c2=COL_MURB or #c3=COL_MURB) then COLI=1:return
   if (#c=COL_MURB or #c1=COL_MURD or #c2=COL_MURD or #c3=COL_MURD) then COLI=1:return
   if (#c=COL_MURG or #c1=COL_MURG or #c2=COL_MURG or #c3=COL_MURG) then COLI=1:return
   if (#c=COL_MUR or #c1=COL_MUR or #c2=COL_MUR or #c3=COL_MUR) then COLI=1
   end

This is my main Collision Function, why Const declaration below ( Decor TILE - 5 types ) and Sprite.

Sorry, my comments code are ine French ! :D

 

The Collision work perfectly with no "Bounce" effects, but when a sprite is bewteen 2 Tiles, it blocks.

I think this is a code problem I have to fix here ... ;)

 

But if you have any suggestions, you're welcome !! :D

And sorry for my crappy english .... ;)

 

Cheers,

Vetea



#14 DZ-Jay ONLINE  

DZ-Jay

    Quadrunner

  • 11,488 posts
  • The P-Machinery AGE is almost here!
  • Location:NC, USA

Posted Tue Nov 6, 2018 4:08 AM

Hey dZ !

Thanks for your future help and other grateful people. :)

 

Here is some code here ( I'm at work .. don't have the full code version. )

'Déclaration Sprites/TILE
   WAIT
   DEFINE DEF00,4,SpritePapiDROITE_0
   WAIT
   DEFINE DEF04,3,SpriteIADroite
   WAIT
   DEFINE DEF07,3,SpriteIABAS
   WAIT
   DEFINE DEF10,3,SpriteIAHAUT
   wait
   DEFINE 13,10,TilesDecor
   WAIT
   
   'Constantes
   CONST MUR_H=$0800+13*8 'Adresse Ecran $0800 + Couleur. Ici NOIR = 0 + Position GRAM * 8 ( TILE 8x8)
   CONST MUR_B=$0800+14*8
   CONST MUR_D=$0800+15*8
   CONST MUR_G=$0800+16*8
   CONST SOL = $0804+17*8   
   CONST MUR = $0800+18*8
   CONST SOL1= $0804+19*8
   
   'Constante Collision Objets
   CONST COL_MURH=BG13 
   CONST COL_MURB=BG14
   CONST COL_MURD=BG15
   CONST COL_MURG=BG16
   CONST COL_MUR= BG18

Test_Collision: PROCEDURE
   'Offset Coordonnée
   if UNIT=0 then #offset = x/8+y/8*20 else #offset = xIA/8+yIA/8*20
   COLI=0

   'Test au 4 coins des objets.
   #c  = PEEK($01FF+#offset)
   #c1 = PEEK($0200+#offset)
   #c2 = PEEK($01EC+#offset)
   #c3 = PEEK($01EB+#offset)
   'Test avec les éléments du tableau.
   if (#c=COL_MURH or #c1=COL_MURH or #c2=COL_MURH or #c3=COL_MURH) and #c<>0 then COLI=1:return
   if (#c=COL_MURB or #c1=COL_MURB or #c2=COL_MURB or #c3=COL_MURB) then COLI=1:return
   if (#c=COL_MURB or #c1=COL_MURD or #c2=COL_MURD or #c3=COL_MURD) then COLI=1:return
   if (#c=COL_MURG or #c1=COL_MURG or #c2=COL_MURG or #c3=COL_MURG) then COLI=1:return
   if (#c=COL_MUR or #c1=COL_MUR or #c2=COL_MUR or #c3=COL_MUR) then COLI=1
   end

This is my main Collision Function, why Const declaration below ( Decor TILE - 5 types ) and Sprite.

Sorry, my comments code are ine French ! :D

 

The Collision work perfectly with no "Bounce" effects, but when a sprite is bewteen 2 Tiles, it blocks.

I think this is a code problem I have to fix here ... ;)

 

But if you have any suggestions, you're welcome !! :D

And sorry for my crappy english .... ;)

 

Cheers,

Vetea

 

No worries, Vetea, I speak Spanish, so reading French is pretty close (although I can't understand it when hearing it).

 

I'll take a look.  Whenever you get a chance, could you post some more details about the problem?  Or if you could post another ROM that shows it, I could check that as well.

 

    -dZ.



#15 Vetea OFFLINE  

Vetea

    Chopper Commander

  • Topic Starter
  • 227 posts
  • Location:France

Posted Tue Nov 6, 2018 4:18 AM

Great !!

Thanks dZ, gracias ! ;)

 

As I say, I'm at work, I don't have the ROM, the complete listing here ... Just only this few lines of code.

The Problem is 

 

-------------------|

                       |

TILE                |

                       |

--------------------

 

8 Pixels  ( Blocked here !)   <--- O ( My Sprite )

                                             Move this way.

-------------------|

                       |

 TILE               |



#16 Vetea OFFLINE  

Vetea

    Chopper Commander

  • Topic Starter
  • 227 posts
  • Location:France

Posted Tue Nov 6, 2018 8:38 AM

Hey again,

During my pause, I've read some tips with Intybasic/Compilation/ASM ...

 

There is no "OR" .. Oooops, I've use it a lot .. ! :D

Try to don't use ( .. AND ... AND ... AND ... ), prefer to use IF THEN IF THEN IF THEN ...

 

Well I have to see my code tonight to change this.

I've code in VB, C, Basic and a little 68000 ASM, ... And now, Intellivision. OMG .. :D



#17 Vetea OFFLINE  

Vetea

    Chopper Commander

  • Topic Starter
  • 227 posts
  • Location:France

Posted Tue Nov 6, 2018 1:10 PM

Hey !

 

I've update the ROM:

You can find it here : https://www.dropbox....etPapi.rom?dl=0

 

I use this link for the future update. ;)

 

And here is the listing:

	REM ====================================
	REM ====        GET PAPI !!         ====
	REM ====           V1.1             ====
	REM ====  (c) 2018 STUDIO VETEA     ====
	REM ====================================
	
	
	' Type de Robot : 1 - Black, 2 - Jaune, 3 - ROuge, 4 - Rose.
	

	INCLUDE "constants.bas"
	INCLUDE "title.bas"
	
	'Fond Vert
	MODE SCREEN_CS, CS_GREEN, GREEN, GREEN,GREEN
	
	'On déclare toutes les variableS.
	Option Explicit
	
	
	'Déclaration Sprites/TILE
	WAIT
	DEFINE DEF00,4,SpritePapiDROITE_0
	WAIT
	DEFINE DEF04,3,SpriteIADroite
	WAIT
	DEFINE DEF07,3,SpriteIABAS
	WAIT
	DEFINE DEF10,3,SpriteIAHAUT
	wait
	DEFINE 13,10,TilesDecor
	WAIT
	DEFINE 23,1,AnimationPorte0
	
	'Constantes
	CONST MUR_H=$0800+13*8 'Adresse Ecran $0800 + Couleur. Ici NOIR = 0 + Position GRAM * 8 ( TILE 8x8)
	CONST MUR_B=$0800+14*8
	CONST MUR_D=$0800+15*8
	CONST MUR_G=$0800+16*8
	CONST SOL = $0804+17*8	
	CONST MUR = $0800+18*8
	CONST SOL1= $0804+19*8
	CONST PORT= $800+23*8
	
	'Constante Collision Objets
	CONST COL_MURH=BG13+FG_BLACK 
	CONST COL_MURB=BG14+FG_BLACK 
	CONST COL_MURD=BG16+FG_BLACK 
	CONST COL_MURG=BG15+FG_BLACK 
	CONST COL_MUR= BG18+FG_BLACK 

	'Variables
	DIM LVL(5)				'DIF IA sur la durée
	DIM #TEMP(5)			'Tempo DIF IA
	DIM X1(5)				'POSX IA
	DIM Y1(5)				'POSY IA
	DIM INT(5)				'INT IA
	DIM TYPE(5)				'TYPE ROBOT IA
	DIM Sens(5)				'DIRECTION IA
	DIM Chemin(5)			'DISTANCE PARCOURUE IA
	DIM CheminMAX(5)		'DISTANCE MAX IA
	DIM TempoAnimation(5)	'TEMPO ANIMATION IA
	DIM TempoIA(5)			'VITESSE IA
	DIM TempoIA_MAX(5)		'VITESSE MAXI IA
	DIM ModeHunt(5)			'Mode Chasse ?
	DIM i,Direction,VitessePapi,TempoPapi,VitessePapiMax,X,Y,PhaseJeu,Value,Temps,TempoTile,FR,XiA,YiA,COLI,OY,OX,T_IA,BX,UNIT,OPENPORTE
	DIM #C,#C1,#C2,#C3,#MIROIR,#SPR,#MIROIR1,#COLOR,#OFFSET,#BESTIME,#TEMPS,#EYE
	

Debut:
	CLS
	'Position/Config Sprites
	for i=1 to 4
		X1(i)=80
		Y1(i)=16
		if i>1 then sens(i)=4 else sens(i)=1 ' Au démarrage les robots suivants attendent leur tour.
		CheminMAX(i)=(RAND % 75)+25
		TempoIA(i)=0
		INT(i)=RAND % 50
		TempoIA_MAX(i)=15
		#TEMP(i)=0
		TempoAnimation(i)=0
		ModeHunt(i)=0
		TYPE(i)=i
		LVL(i)=0
	next
	
	'Variables JEU/Joueur
	Direction=1 '0 HAUT, 1 BAS, 2 DROITE, 3 GAUCHE
	VitessePapi=3
	TempoPapi=0
	VitessePapiMax=3
	if #temps>#Bestime then #Bestime=#Temps
	#Temps=0
	X=80
	Y=56
	PhaseJeu=0
	OPENPORTE=0
	
	'Tableau de jeu
	restore Map
	for i=0 to 239
		read value
		if value=9 then #backtab(i)=0
		if value=17 then #backtab(i)=SOL
		if value=13 then #backtab(i)=MUR_H 
		if value=14 then #backtab(i)=MUR_B 
		if value=15 then #backtab(i)=MUR_D 
		if value=16 then #backtab(i)=MUR_G 
		if value=18 then #backtab(i)=MUR 
	next
	
	
	'Affichage du Temps
	print at (SCREENPOS(0,0)) color CS_WHITE, "TIME :"
	print at (SCREENPOS(7,0)) color CS_WHITE, <3>temps
	print at (SCREENPOS(11,0)) color CS_WHITE, "BEST :"
	print at (SCREENPOS(17,0)) color CS_WHITE, <3>#Bestime
	
	'#########################
	'### Boucle principale ###
	'#########################
	while 1 
		'Animation Tile
		Gosub AnimationTile
		'Gestion temps
		gosub gestionTime
		'Affichage Sprite
		gosub AffSprite
		'Gestion Collision Sprites
		gosub GestionCollision 
		wait
	wend
	
'Animation Tile Tableau
AnimationTile: PROCEDURE
	TempoTile=TempoTile+1
	'Sol
	if TempoTile=32 then DEFINE 17,1,SOL2:wait
	if TempoTile=64 then  DEFINE 17,1,SOL1:wait
	if TempoTile>64 then TempoTile=0
	'Porte
	if PhaseJeu=0 then
		#backtab(29)=PORT
		if OPENPORTE=0 then
			if TempoTile=4 then DEFINE 23,1,AnimationPorte1 :wait
			if TempoTile=8 then DEFINE 23,1,AnimationPorte2 :wait
			if TempoTile=12 then DEFINE 23,1,AnimationPorte3 :wait
			if TempoTile=16 then DEFINE 23,1,AnimationPorte4 :wait
			if TempoTile=20 then DEFINE 23,1,AnimationPorte5 :wait
			if TempoTile=24 then DEFINE 23,1,AnimationPorte6 :wait:OPENPORTE=2
		ELSEIF OPENPORTE=1 then
			if TempoTile=4 then DEFINE 23,1,AnimationPorte6 :wait
			if TempoTile=8 then DEFINE 23,1,AnimationPorte5 :wait
			if TempoTile=12 then DEFINE 23,1,AnimationPorte4 :wait
			if TempoTile=16 then DEFINE 23,1,AnimationPorte3 :wait
			if TempoTile=20 then DEFINE 23,1,AnimationPorte2 :wait
			if TempoTile=24 then DEFINE 23,1,AnimationPorte1 :wait
			if TempoTile=28 then DEFINE 23,1,AnimationPorte0 :wait
			if TempoTile=32 then DEFINE 23,1,AnimationPorte7 :wait:PhaseJeu=1:#backtab(29)=MUR_H
		end if
	end if


	end
	
'Gestion Collision Sprites
GestionCollision: PROCEDURE

	if FRAME then
		'Detection de Papi COL0 avec les 4 autres Sprites Ennemis après une FRAME
		IF COL0 AND HIT_SPRITE4+HIT_SPRITE5+HIT_SPRITE6+HIT_SPRITE7 THEN gosub CollisionSPRITE
		'Detection entre IA/Ralentissement de l'IA.
		if COL4 then if INT(1)>50 then if HIT_SPRITE5+HIT_SPRITE6+HIT_SPRITE7 then
			TempoIA_MAX(1)=15
			INT(1)=0
			LVL(1)=0
			#TEMP(1)=0
		end if
		if COL5 and INT(2)>50 and HIT_SPRITE4+HIT_SPRITE6+HIT_SPRITE7 then
			TempoIA_MAX(2)=15
			INT(2)=0
			LVL(2)=0
			#TEMP(2)=0
		end if
		if COL6 and INT(3)>50 and HIT_SPRITE4+HIT_SPRITE5+HIT_SPRITE7 then
			TempoIA_MAX(3)=15
			INT(3)=0
			LVL(3)=0
			#TEMP(3)=0
		end if
		if COL7 and INT(4)>50 and HIT_SPRITE4+HIT_SPRITE5+HIT_SPRITE6 then
			TempoIA_MAX(4)=15
			INT(4)=0
			LVL(4)=0
			#TEMP(4)=0
		end if
	end if

	return
	end
	
'Gestion du temps
GestionTime: PROCEDURE
	FR=FR+1
	if FR=96 then
		#temps=#temps+1:FR=0
	end if
	print at (SCREENPOS(7,0)) color CS_WHITE, <3>#temps
	return
	end
	
'Procedure de Collision Sprite
CollisionSPRITE: PROCEDURE
	FOR i = 0 TO 31
	WAIT
	SPRITE 0,X+HIT+VISIBLE,Y+ZOOMY2,SPR00+(i AND SPR_WHITE) 
	SPRITE 1,X+HIT+VISIBLE,Y+ZOOMY2,SPR01+(i AND SPR_RED) 
	SPRITE 2,X+HIT+VISIBLE,Y+ZOOMY2,SPR02+(i AND SPR_PINK) 
	SPRITE 3,X+HIT+VISIBLE,Y+ZOOMY2,SPR03+(i AND SPR_BLACK) 
	
	SOUND 0,(i and 7)*32+32,15
	SOUND 1,(i and 7)*36+32,15
	SOUND 2,(i and 7)*40+32,15
	NEXT
	SOUND 0,,0
	SOUND 1,,0
	SOUND 2,,0

	FOR i = 0 to 100
	WAIT
	NEXT
	
	'INIT Sprite
	SPRITE 0,0,0
	SPRITE 1,0,0
	SPRITE 2,0,0
	SPRITE 3,0,0
	SPRITE 4,0,0
	SPRITE 5,0,0
	SPRITE 6,0,0
	SPRITE 7,0,0
	
	goto debut
	return
	end
	
'Offset PAPI
Test_Collision: PROCEDURE
	'Offset Coordonnée
	if UNIT=0 then #offset = x/8+y/8*20 else #offset = xIA/8+yIA/8*20
	COLI=0
	'Test au 4 coins des objets.
	#c  = PEEK($01FF+#offset)
	#c1 = PEEK($0200+#offset)
	#c2 = PEEK($01EC+#offset)
	#c3 = PEEK($01EB+#offset)
	
	'Bord de la MAP
	'Mur Haut ?
	if #c2 =COL_MURH then COLI=1:return
	'Mur Bas ?
	if #c1 =COL_MURB then COLI=1:return
	'Mur Droite
	if #c3 =COL_MURG then COLI=1:return
	'Mur Gauche
	if #c1=COL_MURD then COLI=1:return
	
	'Obstacle
	if #c=COL_MUR then COLI=1:return
	if #c1=COL_MUR then COLI=1:return
	if #c2=COL_MUR then COLI=1:return
	if #c3=COL_MUR then COLI=1:return

	end
	
'Procedure de Gestion de Sprite
 AffSprite: PROCEDURE
	'Gestion Vitesse/Active sur si PAD Actif.
	if CONT then 
		VitessePapi=VitessePapi+1
	else
	'Animation quand PAD inactif
		#Miroir=0
		if Direction=0 then DEFINE DEF00, 4, SpritePapiHAUT_1
		if Direction=1 then DEFINE DEF00, 4, SpritePapiBAS_1
		if Direction=2 then DEFINE DEF00, 4, SpritePapiDROITE_1
		if Direction=3 then DEFINE DEF00, 4, SpritePapiDROITE_1:#miroir=FLIPX
	end if

	'On peut fixer la vitesse de Papi dans la condition.
	if VitessePapi>VitessePapiMax then 
		VitessePapi=0
		TempoPapi=TempoPapi+1
		if TempoPapi>4 then TempoPapi=0
		'Papi Commando !
		'Commandes
		'PAD Actif !
		IF CONT1.UP THEN 
			OY=Y
			Y=Y-1 
			UNIT=0
			gosub Test_Collision
			IF COLI then Y=OY
			Direction=0
			SOUND 1,15,10
			
			if TempoPapi=1 then DEFINE DEF00, 4, SpritePapiHAUT_0
			if TempoPapi=2 then DEFINE DEF00, 4, SpritePapiHAUT_1
			if TempoPapi=3 then DEFINE DEF00, 4, SpritePapiHAUT_2
			if TempoPapi=4 then DEFINE DEF00, 4, SpritePapiHAUT_1
			#miroir=0
		end if
		IF CONT1.DOWN THEN 
			OY=Y
			Y=Y+1
			UNIT=0
			gosub Test_Collision
			if COLI then Y=OY
			Direction=1
			SOUND 1,15,10
			if TempoPapi=1 then DEFINE DEF00, 4, SpritePapiBAS_0
			if TempoPapi=2 then DEFINE DEF00, 4, SpritePapiBAS_1
			if TempoPapi=3 then DEFINE DEF00, 4, SpritePapiBAS_2
			if TempoPapi=4 then DEFINE DEF00, 4, SpritePapiBAS_1
			#miroir=0
		end if
		IF CONT1.LEFT THEN 
			OX=X
			X=X-1 
			UNIT=0
			gosub Test_Collision
			IF COLI then X=OX
			Direction=3
			SOUND 1,15,10
			#miroir=FLIPX
			if TempoPapi=1 then DEFINE DEF00, 4, SpritePapiDROITE_0
			if TempoPapi=2 then DEFINE DEF00, 4, SpritePapiDROITE_1
			if TempoPapi=3 then DEFINE DEF00, 4, SpritePapiDROITE_2
			if TempoPapi=4 then DEFINE DEF00, 4, SpritePapiDROITE_1
		end if
		IF CONT1.RIGHT THEN 
			OX=X
			X=X+1
			UNIT=0
			gosub Test_Collision
			if COLI then X=OX
			Direction=2
			SOUND 1,15,10
			if TempoPapi=1 then DEFINE DEF00, 4, SpritePapiDROITE_0
			if TempoPapi=2 then DEFINE DEF00, 4, SpritePapiDROITE_1
			if TempoPapi=3 then DEFINE DEF00, 4, SpritePapiDROITE_2
			if TempoPapi=4 then DEFINE DEF00, 4, SpritePapiDROITE_1
			#miroir=0
		end if
	end if

	'Affiche les sprites de Papi
	SPRITE 0,X+VISIBLE+HIT,Y+ZOOMY2+#miroir,SPR00+SPR_WHITE
	SPRITE 1,X+VISIBLE+HIT,Y+ZOOMY2+#miroir,SPR01+SPR_RED
	SPRITE 2,X+VISIBLE+HIT,Y+ZOOMY2+#miroir,SPR02+SPR_PINK
	SPRITE 3,X+VISIBLE+HIT,Y+ZOOMY2+#miroir,SPR03+SPR_BLACK 
	
	'Zap de l'IA

	'Sprites Ennemis
	for i=1 to 4
		'Si démarrage partie, alors les robots apparaissent les uns après les autres.
		if OPENPORTE=2 then
			sens(1)=1
			if chemin(i)>128*i then sens(i)=1
			if chemin(1)>128 then sens(2)=1
			if chemin(2)>128 then sens(3)=1
			if chemin(3)>128 then sens(4)=1
			if Chemin(4)>128 then OPENPORTE=1
			if sens(i)=1 then chemin(i)=chemin(i)+1
		else
			#TEMP(I)=#TEMP(I)+1
			if #TEMP(i)>30000 then #TEMP(i)=30000
		end if	
		
		'Au fur et a mesure que le temps passe, les choses se corsent ... ^^
		LVL(i)=#TEMP(I)/128
		if LVL(i)>48 then LVL(i)=48
		if TempoIA_MAX(i)>=LVL(i) then
			T_IA=TempoIA_MAX(i)-LVL(i)
			if T_IA<2 then T_IA=2
		end if
		INT(i)=INT(i)+(LVL(i)*i)
		TempoIA(i)=TempoIA(i)+1
		
		'Gestion Sprite
		if TempoIA(i)>T_IA then 
			'Son
			SOUND 2,500,10
			'Tempo Animation
			TempoAnimation(i)=TempoAnimation(i)+1
			if TempoAnimation(i)>4 then TempoAnimation(i)=1
			TempoIA(i)=0
			
			'Gestion IA/Chemin - Pathfinding
			if PhaseJeu=1 then
				'Test Collision
				xIA=x1(i)
				yIA=y1(i)
				UNIT=1
				gosub Test_Collision
				'Mode Chasse ?
				if int(i)>55 then if ModeHunt(i)=0 then ModeHunt(i)=0 
				'Mode Chasse Activé ?
				if ModeHunt(i)=0 then
					Chemin(i)=Chemin(i)+1
					if Chemin(i)>(CheminMAX(i)) or COLI=1 then
						IF COLI=1 then
							if sens(i)=0 then sens(i)=1:goto fini
							if sens(i)=1 then sens(i)=0:goto fini
							if sens(i)=2 then sens(i)=3:goto fini
							if sens(i)=3 then sens(i)=2:goto fini
						end if
						sens(i)=rand % 4
						Chemin(i)=0
Fini:
					end if
				else
					'Mode Chasse actif !
				end if			
			end if
			'FLIP ?
			#miroir1=0
			#Eye=VISIBLE
PathIA:
			On sens(i) goto ANIM_H,ANIM_B,ANIM_D,ANIM_G
			'Déplacement IA
ANIM_H:
			#SPR=SPR09
			gosub ChoixSprite
			goto suite
ANIM_B:
			#SPR=SPR06
			gosub ChoixSprite
			goto suite
ANIM_D:
			#SPR=SPR03
			gosub ChoixSprite
			goto suite
ANIM_G:
			#miroir1=FLIPX
			#SPR=SPR03
			gosub ChoixSprite
			
Suite:
			'Couleur Sprites
			if i=1 then #Color=SPR_BLACK
			if i=2 then #Color=SPR_YELLOW
			if i=3 then #Color=SPR_RED
			if i=4 then #Color=SPR_PINK
			'Déplacement
			on sens(i) goto HAUTIA,BASIA,DROITEIA,GAUCHEIA,NULL
			
HAUTIA:
			y1(i)=y1(i)-1:goto AFF
BASIA:
			y1(i)=y1(i)+1:goto AFF
DROITEIA:
			x1(i)=x1(i)+1:goto AFF
GAUCHEIA:
			x1(i)=x1(i)-1:goto AFF
NULL:
			#Eye=0
AFF:
			'Affichage ennemis
			SPRITE 3+i,x1(i)+HIT+#Eye,y1(i)+ZOOMY2+#miroir1,#SPR+#Color
		end if
		SOUND 2,,0
	next
Fin:
	SOUND 1,,0
	END

'Selection Sprite IA	
ChoixSprite: Procedure
	if TempoAnimation(i)<4 then
	 #SPR = #SPR +TempoAnimation(i)*8
	else
	 #SPR = #SPR + 2*8
	end if
	End
	

	
'########################
'#### MAP Principale ####
'########################
Map:
	Data 9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9 ' HUD
	Data 13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13,13
	Data 15,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,16
	Data 15,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,16
	Data 15,17,17,18,18,18,17,17,18,17,17,18,17,17,18,18,18,17,17,16
	Data 15,17,17,17,17,18,17,17,17,17,17,17,17,17,18,17,17,17,17,16
	Data 15,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,16
	Data 15,17,17,17,17,18,17,17,17,17,17,17,17,17,18,17,17,17,17,16
	Data 15,17,17,18,18,18,17,17,18,17,17,18,17,17,18,18,18,17,17,16
	Data 15,17,18,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,16
	Data 15,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,17,16
	Data 14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14,14


'########################
'### Ressources TILES ###
'########################
AnimationPorte0:
	BITMAP "#......#"
	BITMAP "########"
	BITMAP "#.#..#.#"
	BITMAP "#......#"
	BITMAP "#......#"
	BITMAP "#.#..#.#"
	BITMAP "########"
	BITMAP "########"
	
AnimationPorte1:
	BITMAP "########"
	BITMAP "#.#..#.#"
	BITMAP "#......#"
	BITMAP "#......#"
	BITMAP "#.#..#.#"
	BITMAP "########"
	BITMAP "########"	
	BITMAP "########"	

AnimationPorte2:
	BITMAP "#.#..#.#"
	BITMAP "#......#"
	BITMAP "#......#"
	BITMAP "#.#..#.#"
	BITMAP "########"
	BITMAP "########"
	BITMAP "########"
	BITMAP "########"
	
AnimationPorte3:
	BITMAP "#......#"
	BITMAP "#......#"
	BITMAP "#.#..#.#"
	BITMAP "########"
	BITMAP "########"
	BITMAP "########"
	BITMAP "########"
	BITMAP "########"

AnimationPorte4:
	BITMAP "#......#"
	BITMAP "#.#..#.#"
	BITMAP "########"
	BITMAP "########"
	BITMAP "########"
	BITMAP "########"
	BITMAP "########"
	BITMAP "########"
	
AnimationPorte5:
	BITMAP "#.#..#.#"
	BITMAP "########"
	BITMAP "########"
	BITMAP "########"
	BITMAP "########"
	BITMAP "########"
	BITMAP "########"
	BITMAP "########"

AnimationPorte6:
	BITMAP "########"
	BITMAP "########"
	BITMAP "########"
	BITMAP "########"
	BITMAP "########"
	BITMAP "########"
	BITMAP "########"
	BITMAP "########"
	
AnimationPorte7:
	BITMAP "#......#"
	BITMAP "#......#"
	BITMAP "########"
	BITMAP "#.#..#.#"
	BITMAP "#......#"
	BITMAP "#......#"
	BITMAP "#.#..#.#"
	BITMAP "########"
	
TilesDecor:
	REM MUR FACE - ID 13
	BITMAP "#......#"
	BITMAP "#......#"
	BITMAP "########"
	BITMAP "#.#..#.#"
	BITMAP "#......#"
	BITMAP "#......#"
	BITMAP "#.#..#.#"
	BITMAP "########"
	
	REM MUR FOND - ID 14
	BITMAP "******#*"
	BITMAP "#.*..*.#"
	BITMAP "#......#"
	BITMAP "#......#"
	BITMAP "#.*..*.#"
	BITMAP "#******#"
	BITMAP "#......#"
	BITMAP "#......#"
	
	REM MUR COTE DROIT - ID 15
	BITMAP "########"
	BITMAP "...#...#"
	BITMAP "...##.*#"
	BITMAP "...#...#"
	BITMAP "...#...#"
	BITMAP "...##.*#"
	BITMAP "...#...#"
	BITMAP "########"
	
	REM MUR COTE GAUCHE - ID 16
	BITMAP "########"
	BITMAP "*...*..."
	BITMAP "**.**..."
	BITMAP "*...*..."
	BITMAP "*...*..."
	BITMAP "**.**..."
	BITMAP "*...*..."
	BITMAP "########"
	
	REM SOL - ID 17
	BITMAP "#.#..#.#"
	BITMAP ".#.##.#."
	BITMAP "#.#..#.#"
	BITMAP ".#....#."
	BITMAP ".#....#."
	BITMAP "#.#..#.#"
	BITMAP ".#.##.#."
	BITMAP "#.#..#.#"
	
	REM MUR SALON - ID 18
	BITMAP "########"
	BITMAP "#......#"
	BITMAP "#......#"
	BITMAP "########"
	BITMAP "#.#..#.#"
	BITMAP "#......#"
	BITMAP "#.#..#.#"
	BITMAP "########"
	
SOL2:
	REM SOL2 
	BITMAP ".#.##.#."
	BITMAP "#.#..#.#"
	BITMAP ".#.##.#."
	BITMAP "#.####.#"
	BITMAP "#.####.#"
	BITMAP ".#.##.#."
	BITMAP "#.#..#.#"
	BITMAP ".#.##.#."
	
SOL1:
	REM SOL - ID 17
	BITMAP "#.#..#.#"
	BITMAP ".#.##.#."
	BITMAP "#.#..#.#"
	BITMAP ".#....#."
	BITMAP ".#....#."
	BITMAP "#.#..#.#"
	BITMAP ".#.##.#."
	BITMAP "#.#..#.#"
	
	
'##########################
'### Ressources SPRITES ###
'##########################
	
'Sprite Papi
SpritePapiHaut_0:
	'WHITE
	BITMAP ".#....#."
	BITMAP "........"
	BITMAP ".#....#."
	BITMAP "..#..#.."
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	'RED
	BITMAP "........"
	BITMAP "#######."
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	'PINK
	BITMAP "..####.."
	BITMAP "........"
	BITMAP "..####.."
	BITMAP "...##..."
	BITMAP "..#....."
	BITMAP ".#...#.."
	BITMAP "......#."
	BITMAP "........"
	'BLACK
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "...###.."
	BITMAP "..###..."
	BITMAP ".##.##.."
	BITMAP ".....##."
	
SpritePapiHaut_1:
	'WHITE
	BITMAP "........"
	BITMAP ".#....#."
	BITMAP "........"
	BITMAP ".#....#."
	BITMAP "..#..#.."
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	'RED
	BITMAP "........"
	BITMAP "........"
	BITMAP ".######."
	BITMAP "#......."
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	'PINK
	BITMAP "........"
	BITMAP "..####.."
	BITMAP "........"
	BITMAP "..####.."
	BITMAP "...##..."
	BITMAP "..#..#.."
	BITMAP ".#....#."
	BITMAP "........"
	'BLACK
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "...##..."
	BITMAP "..####.."
	BITMAP "..####.."
	
SpritePapiHaut_2:
	'WHITE
	BITMAP ".#....#."
	BITMAP "........"
	BITMAP ".#....#."
	BITMAP "..#..#.."
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	'RED
	BITMAP "........"
	BITMAP "#######."
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	'PINK
	BITMAP "..####.."
	BITMAP "........"
	BITMAP "..####.."
	BITMAP "...##..."
	BITMAP ".....#.."
	BITMAP "...#..#."
	BITMAP "..#....."
	BITMAP "........"
	'BLACK
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "..###..."
	BITMAP "...###.."
	BITMAP "..##.##."
	BITMAP ".##....."
	
SpritePapiBAS_0:
	'WHITE
	BITMAP ".#....#."
	BITMAP "..#..#.."
	BITMAP ".#....#."
	BITMAP ".#.##.#."
	BITMAP "..####.."
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	'RED
	BITMAP "........"
	BITMAP "##.##.#."
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	'PINK
	BITMAP "..####.."
	BITMAP "........"
	BITMAP "...##..."
	BITMAP "..#..#.."
	BITMAP "........"
	BITMAP ".#......"
	BITMAP "......#."
	BITMAP "........"
	'BLACK
	BITMAP "........"
	BITMAP "........"
	BITMAP "..#..#.."
	BITMAP "........"
	BITMAP "........"
	BITMAP "..####.."
	BITMAP ".##.##.."
	BITMAP ".....##."
	
SpritePapiBAS_1:
	'WHITE
	BITMAP "........"
	BITMAP ".#....#."
	BITMAP "..#..#.."
	BITMAP ".#....#."
	BITMAP ".#.##.#."
	BITMAP "..####.."
	BITMAP "........"
	BITMAP "........"
	'RED
	BITMAP "........"
	BITMAP "........"
	BITMAP ".#.##.#."
	BITMAP "#......."
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	'PINK
	BITMAP "........"
	BITMAP "..####.."
	BITMAP "........"
	BITMAP "...##..."
	BITMAP "..#..#.."
	BITMAP "........"
	BITMAP ".#....#."
	BITMAP "........"
	'BLACK
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "..#..#.."
	BITMAP "........"
	BITMAP "........"
	BITMAP "..####.."
	BITMAP "..####.."
	
SpritePapiBAS_2:
	'WHITE
	BITMAP ".#....#."
	BITMAP "..#..#.."
	BITMAP ".#....#."
	BITMAP ".#.##.#."
	BITMAP "..####.."
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	'RED
	BITMAP "........"
	BITMAP "##.##.#."
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	'PINK
	BITMAP "..####.."
	BITMAP "........"
	BITMAP "...##..."
	BITMAP "..#..#.."
	BITMAP "........"
	BITMAP "......#."
	BITMAP ".#......"
	BITMAP "........"
	'BLACK
	BITMAP "........"
	BITMAP "........"
	BITMAP "..#..#.."
	BITMAP "........"
	BITMAP "........"
	BITMAP "..####.."
	BITMAP "..##.##."
	BITMAP ".##....."

SpritePapiDROITE_0:
	'WHITE
	BITMAP ".#......"
	BITMAP "..##.##."
	BITMAP ".#......"
	BITMAP ".##.#.#."
	BITMAP "..####.."
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	'RED
	BITMAP "........"
	BITMAP "##..#..."
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	'PINK
	BITMAP "..#####."
	BITMAP "........"
	BITMAP "..#.#.#."
	BITMAP "...#.#.."
	BITMAP "........"
	BITMAP ".##...#."
	BITMAP ".#......"
	BITMAP "........"
	'BLACK
	BITMAP "........"
	BITMAP "........"
	BITMAP "...#.#.."
	BITMAP "........"
	BITMAP "........"
	BITMAP "...###.."
	BITMAP "..####.."
	BITMAP "..#..##."
	
SpritePapiDROITE_1:
	'WHITE
	BITMAP "........"
	BITMAP ".#......"
	BITMAP "..##.##."
	BITMAP ".#......"
	BITMAP ".##.#.#."
	BITMAP "..####.."
	BITMAP "........"
	BITMAP "........"
	'RED
	BITMAP "........"
	BITMAP "........"
	BITMAP ".#..#..."
	BITMAP "#......."
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	'PINK
	BITMAP "........"
	BITMAP "..#####."
	BITMAP "........"
	BITMAP "..#.#.#."
	BITMAP "...#.#.."
	BITMAP "........"
	BITMAP "..#...#."
	BITMAP "........"
	'BLACK
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "...#.#.."
	BITMAP "........"
	BITMAP "........"
	BITMAP "...###.."
	BITMAP "..####.."
	
SpritePapiDROITE_2:
	'WHITE
	BITMAP ".#......"
	BITMAP "..##.##."
	BITMAP ".#......"
	BITMAP ".##.#.#."
	BITMAP "..####.."
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	'RED
	BITMAP "........"
	BITMAP "##..#..."
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	BITMAP "........"
	'PINK
	BITMAP "..#####."
	BITMAP "........"
	BITMAP "..#.#.#."
	BITMAP "...#.#.."
	BITMAP "........"
	BITMAP "...#...."
	BITMAP ".#..#..."
	BITMAP "........"
	'BLACK
	BITMAP "........"
	BITMAP "........"
	BITMAP "...#.#.."
	BITMAP "........"
	BITMAP "........"
	BITMAP "..#.##.."
	BITMAP "..##.##."
	BITMAP ".#...#.."

'Sprite IA	
SpriteIAHAUT:
	BITMAP "..####.."
	BITMAP ".######."
	BITMAP ".######."
	BITMAP "..####.."
	BITMAP ".#####.."
	BITMAP "..#####."
	BITMAP ".##.##.."
	BITMAP ".....##."
	
	BITMAP "........"
	BITMAP "..####.."
	BITMAP ".######."
	BITMAP ".######."
	BITMAP "..####.."
	BITMAP ".######."
	BITMAP "..####.."
	BITMAP ".##..##."

	BITMAP "..####.."
	BITMAP ".######."
	BITMAP ".######."
	BITMAP "..####.."
	BITMAP "..#####."
	BITMAP ".#####.."
	BITMAP "..##.##."
	BITMAP ".##....."
	
SpriteIABAS:
	BITMAP "..####.."
	BITMAP ".######."
	BITMAP ".#.##.#."
	BITMAP "..####.."
	BITMAP ".#####.."
	BITMAP "..#####."
	BITMAP ".##.##.."
	BITMAP ".....##."
	
	BITMAP "........"
	BITMAP "..####.."
	BITMAP ".######."
	BITMAP ".#.##.#."
	BITMAP "..####.."
	BITMAP ".######."
	BITMAP "..####.."
	BITMAP ".##..##."
	
	BITMAP "..####.."
	BITMAP ".######."
	BITMAP ".#.##.#."
	BITMAP "..####.."
	BITMAP "..#####."
	BITMAP ".#####.."
	BITMAP "..##.##."
	BITMAP ".##....."
	
SpriteIADroite:
	BITMAP "..####.."
	BITMAP ".####.#."
	BITMAP ".###.##."
	BITMAP "..####.."
	BITMAP "...####."
	BITMAP "...###.."
	BITMAP "..##.##."
	BITMAP "..#....."

	BITMAP "........"
	BITMAP "..####.."
	BITMAP ".####.#."
	BITMAP ".###.##."
	BITMAP "..####.."
	BITMAP "...##..."
	BITMAP "...##..."
	BITMAP "...###.."

	BITMAP "..####.."
	BITMAP ".####.#."
	BITMAP ".###.##."
	BITMAP "..####.."
	BITMAP "...##..."
	BITMAP "..####.."
	BITMAP "...#.##."
	BITMAP "..#....."


	

I've learn IntyBasic and Intellivision since few days .. So sorry if I make some errors/Code/Optimisation.

 

For now, I don't fix my collision yet ... But I search.

But if you have any tips, you're welcome ! :D

 

Cheers,

Vetea

 

 

 



#18 DZ-Jay ONLINE  

DZ-Jay

    Quadrunner

  • 11,488 posts
  • The P-Machinery AGE is almost here!
  • Location:NC, USA

Posted Wed Nov 7, 2018 6:09 AM

Hi, Vetea,

 

I am so sorry, but I still do not understand the collision problem.  I thought I could experience it from the updated ROM, but there do not seem to be any sprite "blocked" in it.

 

Do you mean that if you have two BACKTAB tiles with 8 pixels of empty space in between, the sprite cannot move into the empty space?

 

For example, if you have the following background tiles,

+........+          +........+
.        .          .        .
.        .          .        .
.        .          .        .
.  TILE  .          .  TILE  .
.   1    .          .   2    .
.        .          .        .
.        .  \   /   .        .
.        .   \ /    .        .
+........+    X     +........+
             / \
            /   \
              .
             /|\
              | 
              | 
            ______
           /      \
          |  PAPI  |
          |        |
           \______/

Papi is not able to move in between them.

 

Is that the problem?

 

I will have to analyse your collision code to see how it works and determine what could be the flaw.

 

At first glance, it looks to me that you are taking the sprite coordinates, converting them into a BACKTAB address, and comparing the type of card underneath.  Take into consideration that the sprite's origin is on the top-left corner of the object.  Since its position is based on its origin, then it means that the BACKTAB card you are getting is the one where the top-left corner of the sprite resides.

 

So consider this:

+........+         +........+
.        .         .        .
.        .         .        .
.        .         .        .
.  TILE  .         .  TILE  .
.   1    .         .   2    .
.        .         .        .
.        .         .        .
.        .         .        .
+........+         +........+
          ^
          .
          .
          .
          ########
          ########
          ########
          ########
          ########
          ########
          ########
          ########

If the sprite top-left corner happens to fall on the blocked card, then the collision will be triggered, even though the sprite should have space to go between them.

 

To address this, you may need to change your formula to account for the center-point of the sprite, and not its origin.  Perhaps use an offset of four pixels from the origin, like this:

  if UNIT=0 then #offset = (x + 4)/8+(y + 4)/8*20 else #offset = (xIA +4)/8+(yIA + 4)/8*20

The other thing to account for is "off-by-one" errors:  make sure that all your units are zero-based, so that you don't end up getting the wrong card.

 

 

 

Hey again,

During my pause, I've read some tips with Intybasic/Compilation/ASM ...

 

There is no "OR" .. Oooops, I've use it a lot .. ! :D

Try to don't use ( .. AND ... AND ... AND ... ), prefer to use IF THEN IF THEN IF THEN ...

 

Well I have to see my code tonight to change this.

I've code in VB, C, Basic and a little 68000 ASM, ... And now, Intellivision. OMG .. :D

 

There is no OR instruction in the CPU, so it is implemented in terms of AND and XOR instructions, and therefore it is expensive.  It is fine to use it once in a while, but not in critical statements, such as conditional blocks in the critical path.

 

The point about avoiding too many AND operators is because each one requires the evaluation of both sides (there is no short-circuit evaluation at the moment).  Therefore, it is faster to just "nest" the conditions like instead of this:

  if COL5 and INT(2)>50 and HIT_SPRITE4+HIT_SPRITE6+HIT_SPRITE7 then

do this:

  if COL5 then
    if HIT_SPRITE4+HIT_SPRITE6+HIT_SPRITE7 then
      ' Your code here
    end if
  end if

That way, if the first condition tests false, the second one will not be evaluated.

 

 

I hope this helps.

 

     -dZ.


Edited by DZ-Jay, Wed Nov 7, 2018 6:11 AM.


#19 Vetea OFFLINE  

Vetea

    Chopper Commander

  • Topic Starter
  • 227 posts
  • Location:France

Posted Wed Nov 7, 2018 6:24 AM

Muchas gracias dZ !
I see that tonight. ;)

#20 DZ-Jay ONLINE  

DZ-Jay

    Quadrunner

  • 11,488 posts
  • The P-Machinery AGE is almost here!
  • Location:NC, USA

Posted Wed Nov 7, 2018 6:24 AM

One more suggestion I will make:  The WAIT instruction in IntyBASIC blocks the program in a "busy-loop" waiting for the next Vertical Blanking interrupt, which occurs at 60 Hz on NTSC hardware and 50 Hz on PAL hardware.  You normally only have to use it under the following situations:

  • To gain access to the GRAM (Graphics RAM) and the STIC (video chip) registers, which includes MOB attributes and video mode.
  • To synchronize your game loop to the raster trace, so that as soon as your game loop frame is complete, you wait for the next boundary to compose the next one.

The first one is important because in the Intellivision you cannot access the graphics bus except during a brief window right after the Vertical Blanking interrupt occurs.  The second one is typical because it keeps your game engine's pace.

 

The typical game engine on the Intellivision (in IntyBASIC or else) is like this:

  • Critical stuff that needs to happen first during a very short window (VBLANK 1):
    • WAIT for the next VBLANK interrupt
    • Read collision registers
    • Update MOB positions and attributes
  • Secondary stuff that has a little more time to access bus (VBLANK 2):
    • Update GRAM cards
  • Tertiary stuff that needs to occur on every frame but is not limited to VBLANK window:
    • Update timers music tracker and sound effects
    • Read hand-controller information
    • Update sprite animation state
  • Game engine:
    • Test for collisions
    • Apply AI
    • Update logical sprites positions and state
    • everything else

Because of the dependency on VBLANK to access the STIC, game engines are typically one frame behind.  That is, after WAIT, your game is updating the STIC and GRAM from its computed game state of the previous frame.  Then when it finishes that, it starts computing the next frame, until the next WAIT iteration, and it repeats.

 

This is important to understand because your collisions are not been tested against the new values you are computing, but against the values your sprites had in the previous frame and were copied to the STIC now.

 

I hope this makes sense.

 

     -dZ.



#21 Vetea OFFLINE  

Vetea

    Chopper Commander

  • Topic Starter
  • 227 posts
  • Location:France

Posted Wed Nov 7, 2018 6:45 AM

Ok.

 

So , if I understand ( I guess ... ^^ ), in my main loop :

 

While 1

 

// Phase 1

Update PAD Control

Animation Sprite

WAIT

 

// Phase 2

Collision

AI

Display Sprite

...

WAIT

Wend

 

2 WAIT in the same loop.

 

... See that tonight too.



#22 DZ-Jay ONLINE  

DZ-Jay

    Quadrunner

  • 11,488 posts
  • The P-Machinery AGE is almost here!
  • Location:NC, USA

Posted Wed Nov 7, 2018 9:20 AM

Ok.

 

So , if I understand ( I guess ... ^^ ), in my main loop :

 

While 1

 

// Phase 1

Update PAD Control

Animation Sprite

WAIT

 

// Phase 2

Collision

AI

Display Sprite

...

WAIT

Wend

 

2 WAIT in the same loop.

 

... See that tonight too.

 

If you do that, your game will run at 30 Hz, which is fine if that is what you are looking for.  If you aim for a 60 Hz game loop, then you do something like this:

 

  • While (1)
    • WAIT
    • // Phase 1
      • Get collision values locally (I think COLx does that for you)
      • Update STIC registers (MOB position registers from logical variables, animations, attributes, etc.)
      • Update GRAM cards
      • Update timers (if any)
    • // Phase 2
      • Test collisions
      • Update AI
      • Update sprite logical sprite positions (x, y variables)
      • Update sprite logical animation state (cards to copy, frame counters, etc.)
  • Wend

The updated state in Phase 2 (Frame "n") will be posted to the hardware registers on next Phase 1 (Frame "n + 1").  However, for this to work, you'll need to make sure both phases fit within a single VBLANK cycle.  This is possible but may not be necessary.

 

Doing it with two WAITs will work great if you do not need 60 Hz state granularity (which not all games need).

 

    -dZ.


Edited by DZ-Jay, Wed Nov 7, 2018 9:23 AM.


#23 Vetea OFFLINE  

Vetea

    Chopper Commander

  • Topic Starter
  • 227 posts
  • Location:France

Posted Wed Nov 7, 2018 4:55 PM

Hey there !!

 

Finally I got it !!!!!!! :D :D :D

 

 

The detection TILE/Sprite is "pixel perfect". 3 fuckin... days on this problem ...

You can test the ROM. ;)

 

 

Attached Files



#24 DZ-Jay ONLINE  

DZ-Jay

    Quadrunner

  • 11,488 posts
  • The P-Machinery AGE is almost here!
  • Location:NC, USA

Posted Wed Nov 7, 2018 5:47 PM

Hey there !!

 

Finally I got it !!!!!!! :D :D :D

 

 

The detection TILE/Sprite is "pixel perfect". 3 fuckin... days on this problem ...

You can test the ROM. ;)

 

 

 

Great!  I can see now that Papi can get close to the walls, which he couldn't do before.   :thumbsup:

 

   -dZ.

 

 

P.S.  The ROM that you posted is broken even worse than before:  When I get Papi close to the space between the walls on the left, he gets stuck there.  Then, if I hit down, he moves only one pixel and gets stuck, and now he can't move in any direction.



#25 Vetea OFFLINE  

Vetea

    Chopper Commander

  • Topic Starter
  • 227 posts
  • Location:France

Posted Wed Nov 7, 2018 10:51 PM

Hey dZ !

I'm so sorry, I upload the wrong ROM ... My bad !

I have 36202020 listings for now with my debug version ahah ... :D

 

Now it's the good one ... I hope ! ;)

Cheers,

Vetea

Attached Files






0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users