Zitat:
Zitat von cruisx
Someone said that earlier, sorry forgot who :oZitat:
Look for Box-Line collision on Google.
Printable View
Zitat:
Zitat von cruisx
Someone said that earlier, sorry forgot who :oZitat:
Look for Box-Line collision on Google.
I have got a error when i try to compile.
http://img505.imageshack.us/img505/3618/naamloosgy2.jpg
:facepalm:
You spelled debug wrong.
*Sigh* have you even tried seeing what the error is?
pspdebub does not exist, is exactly true, its pspdebug.
-Aura
EDIT: Archaemic beat me to it :Argh:
I think you spelt pspdebug.h wrong in the include, you wrote:
When it should be:Code:#include <pspdebub.h>
EDIT: Beaten...Code:#include <pspdebug.h>
Zitat:
Zitat von Moose Island
Sorry for this stupid action of me i am just a starter but thanks.
I have the address of a function of mine which is not working, and I want to link a new function in its place. I think I found a post a while ago showing the same basic idea, where it replaced the address of the function in memory,and I've been searching for close to an hour to find it again with no luck. Can anyone give me some example code or link me to the post again if you somehow know the post? The post, IIRC, was about getting sceKernelExitGame to link to the devs shell, and to not exit to the XMB instead, incase thats of any help.
Thanks.
-Aura
I don't know how, but I remember that thread also.Zitat:
Zitat von Auraomega
http://forums.qj.net/1404504-post8.html
I think that's it.
Zitat:
Zitat von BigSanFrey
ok thanks, ill see if box-line collision helps me and if i understand it =)
also someone else told me to use his, just wondering what you guys think..
Code:typedef enum
{
TILE_PLAYER=1,
TILE_GRASS=2...ETC
}
inline int getCurrentTileType(const int& x,const int& y,const map& themap)
{
return (((x>=themap.width() ||y>=themap.height() ||y<0||x<0)?-1 :themap.tiles[y][x]));
}
inline void getTilePos(const int& wanted_tile,int& px,int& py,const map& themap)
{
px=-1,py=-1;
int x=0,y=0;
for (y=0;y<themap.height();y++)
{
for (x=0;x<themap.width();x++)
{
if ( getCurrentTileType(px,py,themap) != wanted_tile ) continue;
px = x;
py = y;
return;
}
}
}
int main()
{
map themap;
while(running)
{
int player_x,player_y,current_tile;
getTilePos(TILE_PLAYER,player_x,player_y,themap);
current_tile = getCurrentTileType(player_x,player_y,themap);
if(current_tile == TILE_GRASS)
{
//COLLISON! do whatever..
}
if(timer.diff() >= 10)..cleanup render etc..
}
}
In my Lua tile engine, that's how I did collision detection. And IMO, it's a very fast and easy way.Zitat:
Zitat von cruisx
Yep, in one, thanks for that :)Zitat:
Zitat von Judas
@cruisx:
Thats, in my opinion, the easiest and quickest method of 2D collision, I only use Box-Line collision for 3D and the method you posted for 2D collisions.
-Aura
Zitat:
Zitat von Auraomega
ok sweet =p.this might sound noobish but can i use that in Oslib or do i have to convert it for it to work?:PC:
That method should work just fine in OSLib I believe, I use the method with graphics.c and OSLib is similar in the way it acts.
-Aura
-= Double Post =-
My code, in another module to my existing faulty code:
The above code works if its directly done into the main Project4 code, but when its done from an external module it crashes the PSP. My assumption is that the address not correct.Code:int load_MUSIC(char bpath[], int clockA, int clockB);
int load_MUSIC_patched(char bpath[], int clockA, int clockB)
{
// Corrected code
}
int module_start()
{
*((unsigned int *)load_MUSIC) = J(load_MUSIC_patched);
return 0;
}
int module_stop(void)
{
return 0;
}
I have used a stub file:
is the underlined pointer the address in memory which the function will be loaded (I doubt because isn't the memory dynamic?), or is it the NID? If its the NID, is there a function to find the memory location using the NID?Code:.set noreorder
#include "pspstub.s"
STUB_START "Project4Stub",0x40090000,0x00010005
STUB_FUNC 0x7DD2EC2C,load_MUSIC
STUB_END
-Aura
can someone help me out with the collision detection? I made it so that it works for the walls but i am a bit confused on how to use this code for various parts of the map, sorry for all the questions, it is my first time and i don't understand some of the stuff.
http://media.twango.com/m1/original/...2fbd03756c.png
like for example the wood fence.
Code:typedef enum
{
TILE_PLAYER=1,
TILE_GRASS=2...ETC
}
inline int getCurrentTileType(const int& x,const int& y,const map& themap)
{
return (((x>=themap.width() ||y>=themap.height() ||y<0||x<0)?-1 :themap.tiles[y][x]));
}
inline void getTilePos(const int& wanted_tile,int& px,int& py,const map& themap)
{
px=-1,py=-1;
int x=0,y=0;
for (y=0;y<themap.height();y++)
{
for (x=0;x<themap.width();x++)
{
if ( getCurrentTileType(px,py,themap) != wanted_tile ) continue;
px = x;
py = y;
return;
}
}
}
int main()
{
map themap;
while(running)
{
int player_x,player_y,current_tile;
getTilePos(TILE_PLAYER,player_x,player_y,themap);
current_tile = getCurrentTileType(player_x,player_y,themap);
if(current_tile == TILE_GRASS)
{
//COLLISON! do whatever..
}
if(timer.diff() >= 10)..cleanup render etc..
}
}
heres my code
Code://OSlib header file
#include <oslib/oslib.h>
//Include the Data part of the map
#include "Ocean.h"
//Necessary to create eboot
PSP_MODULE_INFO("OSLib Sample", 0, 1, 1);
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU);
//declaration of the pointers of our images
OSL_IMAGE *sprite, *Ocean_tileset;
//declaration of the pointers of our Map
OSL_MAP *Ocean;
//definitions
#define DOWN 0
#define UP 35
#define RIGHT 70
#define LEFT 105
//variables
int sprite_position;
int sprite_march;
int i;
//function declarations
void Buttons();
void SpriteAnimate();
int main()
{
//Initialization of the Oslib library
oslInit(0);
//Initialization of the graphics mode
oslInitGfx(OSL_PF_8888, 1);
//Shows the psp-hacks hombrew competition splash screen
oslShowPSPHacksLogo();
//Sets the transparency color (pink)
oslSetTransparentColor(RGB(255,0,255));
//loads our images into memory
Ocean_tileset = oslLoadImageFile("tileset.png", OSL_IN_RAM, OSL_PF_5551);
sprite = oslLoadImageFile("sprite.png", OSL_IN_RAM, OSL_PF_5551);
//Disables the transpaent color (pink)
oslDisableTransparentColor();
//verification that all files are present
if (!sprite || !Ocean_tileset)
oslDebug("It is impossible to load one or more of the images that are required in this program. Please make sure you have all the files required in the eboot folder");
//configuration of the Map
Ocean = oslCreateMap(
Ocean_tileset, //Tileset
Ocean_map, //Map
16,16, //Size of the tiles
64,65, //Size of the Map
OSL_MF_U16); //Format of the Map
//Sets the sprite's original position on the screen
sprite->x = 155;
sprite->y = 95;
sprite_position = DOWN;
//main while loop
while (!osl_quit)
{
//To be able to draw on the screen
oslStartDrawing();
//calls the Buttons() function
Buttons();
//Draws the Map on the screen
oslDrawMapSimple(Ocean);
//Draw the images to the screen
oslDrawImage(sprite);
//Ends drawing mode
oslEndDrawing();
//Synchronizes the screen
oslSyncFrame();
}
//Terminate the program
oslEndGfx();
oslQuit();
return 0;
}
void Buttons()
{
//initiate the PSP's buttons
oslReadKeys();
//Takes a screenshot of the PSP's screen
if (osl_keys->pressed.select)
oslWriteImageFilePNG(OSL_SECONDARY_BUFFER, "screenshot.png", 0);
//Basic border collision
if (sprite->x <= 0)
sprite->x = 0;
if (sprite->y <= 0)
sprite->y = 0;
if (sprite->x >= 460)
sprite->x = 460;
if (sprite->y >= 239)
sprite->y = 239;
if (osl_keys->held.down)
{
Ocean->scrollY += 8;
sprite->y += 1;
sprite_position = DOWN;
SpriteAnimate();
}
if (osl_keys->held.up)
{
Ocean->scrollY -= 8;
sprite->y -= 1;
sprite_position = UP;
SpriteAnimate();
}
if (osl_keys->held.right)
{
Ocean->scrollX += 8;
sprite->x += 1;
sprite_position = RIGHT;
SpriteAnimate();
}
if (osl_keys->held.left)
{
Ocean->scrollX -= 8;
sprite->x -= 1;
sprite_position = LEFT;
SpriteAnimate();
}
//If a button is not pressed
if (!osl_keys->held.value)
{
//Start the variable over for when a button is pressed again
sprite_march = 0;
//Sets the sprite's direction
oslSetImageTileSize(sprite,0,sprite_position,22,35);
}
}
void SpriteAnimate()
{
//Moves the sprite in the row that it is in
sprite_march++;
//Moves the sprite constantly with no static position
oslSetImageTileSize(sprite,(sprite_march * 22),sprite_position,22,35);
//resets the sprite movement in that row
if (sprite_march == 6) sprite_march = 0;
}
hey if i wanted to splash an image, what kind of could would i use. this is for the computer. im having a real hard time finding it on google.
thanks
what lib are you using?
How can I set the formatting on a float? I have the presision set as high as I need it, but I was wondering if there was any way to remove the trailing zeros when they are not needed?
is the underlined pointer the address in memory which the function will be loaded (I doubt because isn't the memory dynamic?), or is it the NID? If its the NID, is there a function to find the memory location using the NID?Code:.set noreorder
#include "pspstub.s"
STUB_START "Project4Stub",0x40090000,0x00010005
STUB_FUNC 0x7DD2EC2C,load_MUSIC
STUB_END
-Aura
Hey,Zitat:
Zitat von Auraomega
Im not sure i quite understand you but if you do 0.%f it will get rid of the 0's so the number is displayed like an integer. For example:
will display 10 instead of 10.000...Code:float a;
a = 10.0;
pspDebugScreenPrintf("0.%f", a);
Just a quick question, iv written a small function to remove a given colour from an image using graphics.h. Problem is that putPixelImage() doesnt support alpha colours so how else could i go about changing the pixel colour to transparent?
From memory:
Code:float a = 10.3425465577;
printf("0.%f", a); // 10
printf("0.2%f", a); // 10.34
printf("5.2%f", a); // 00010.34
Yeah, but doesn't that way remove them completely? I have presision set to what value I need, but when not all digits after the decimal point are being used I want to remove the trailing zeros, not completely remove them altogether. If theres no way to do this with formatting, would there be any way to check the significant figures, and make the length equal to this value? (I know you can change the length with a variable, I'm just not sure how to check the length).
-Aura
No, why would it if it isn't writing to the variable?Zitat:
Zitat von Auraomega
Hmm, let me put it another way now I have more time to explain:
The first output gives trailing zeros, the second output is what I am actually aiming for (without the trailing zeros), I can't set the presision to what is needed, as the value used will actually be dynamic.Code:float e = 2.71;
printf("%5.5f", e) // 2.71000
printf("%5.2f", e) // 2.71
(Oh, and 5.2%f is incorrect, the presision should go between the % and the f, not before, else you get 5.2[value], and the %5.2 doesn't appear to give zeros in front of the number).
-Aura
Honestly, I don't think you can due the IEEE format. In addition, 2.71 might actually be 2.710000000000000001 due to the nature of floating points.
First of all I have to ask why you need to do this, perhaps there is a better method to achieve your goal.
Also, I generally use fabs() for things like this.
I'm trying to throw together a basica calculator, and to keep it to some level of presision, I'm needing to use floats, when the answer has been found it becomes the next value, thus meaning the first and last value at least have to have presision. Theres probably a better way, but for the 10 odd minutes I've spent overall making it, I've not thought of one, and since creating it I've been working on other things.
Also, isn't fabs just modulus?
-Aura
C or C++?
Edit: Actually, don't iostream and printf output float values up to the first trailing 0 by default?
I'm currently using C, and its a small tool in a big project, so I can't really turn it into C++ even if theres an easy solution.
-Aura
One REALLY roundabout method I can think of is to convert the float to a char string and transverse from the end of the string to the front looking for '0's until it hits a non '0' character and place a null terminator there.
I see if I can whip up an example.
Hmm, that definatly seems a good idea, and I can't believe I hadn't thought of it myself, it wouldn't even be that hard to make, I'll get onto that right away.
Thanks.
-Aura
Remember what I said about floats and precision? Well it is highlighted by what we are trying to do:
Output:Code:#include <stdio.h>
#include <string.h>
int main()
{
const int BUFFER_SIZE = 128;
char buffer[BUFFER_SIZE] = "";
float aFloat = 3.65000f;
snprintf( buffer, BUFFER_SIZE-1, "%.128f", aFloat );
buffer[BUFFER_SIZE-1] = '\0';
printf( buffer );
printf( "\n" );
for( int i = strlen(buffer) - 1; i >= 0 && buffer[i] == '0'; --i )
{
buffer[i] = '\0';
}
printf( buffer );
return 0;
}
Code:3.6500000953674316406250000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
3.650000095367431640625
Code:/*****************************************************\
Auteur : Foury Jean-francois
Auteur de : Super Mario toy
Jour 10 collision entre 1 sprite et une map
\*****************************************************/
//La librairie principale OSLib
#include <oslib/oslib.h>
#include "collisions.h"
#include "sprite.h"
//les callbacks
PSP_MODULE_INFO("OSLib Sample", 0, 1, 1);
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU);
//definition des pointeurs vers notre map
OSL_MAP *Map01, *Map_collision;
OSL_IMAGE *Map01_tileset, *collision_tileset;
#define TILE_NOSOLID 0
#define TILE_SOLID 1
OSL_IMAGE *Joueur ;
//fonctions
void Touches();
void AnimMarche();
void Gestion_Map();
short GetTile(OSL_MAP *m,int col, int row);
int oslCollisionMap(OSL_MAP *m,OSL_IMAGE *sprite,int haut,int bas, int gauche, int droit);
/*
====================
colision
Verifie si il y a une colision entre 2 sprites
====================
*/
int main()
{
//Initialisation de la librairie
oslInit(0);
//Initialisation du mode graphique
oslInitGfx(OSL_PF_8888, 1);
//chargement de nos images (oui, le "loading" :p)
Map01_tileset = oslLoadImageFile("sprite_s.png", OSL_IN_RAM, OSL_PF_5551);
collision_tileset = oslLoadImageFile("collisions_s.png", OSL_IN_RAM, OSL_PF_5551);
Joueur= oslLoadImageFile("player.png", OSL_IN_RAM, OSL_PF_5551);
//place Le joueur vers le centre de l'écran et dans sa position de départ
Joueur->x = 240;
Joueur->y = 130;
Gestion_Map(); //Initialisation des map
//boucle principale
while (!osl_quit)
{
//Permet de dessiner
oslStartDrawing();
//check des touches
Touches();
//Affiche la map concerner, mais n'affiche pas la map des collision
oslDrawMapSimple(Map01);
//dessine nos sprite
oslDrawImage(Joueur);
//Fin du dessin
oslEndDrawing();
//Synchronise l'écran
oslSyncFrame();
}
//on quitte l'application
oslEndGfx();
oslQuit();
return 0;
}
/*
====================
Touches
Gestion des touches pour le jeux :)
====================
*/
void Touches()
{
//Lit les touches
oslReadKeys();
if (osl_keys->held.down)
{
if (!oslCollisionMap(Map_collision,Joueur,0,1,0,0))
{
//ok on bouge
Joueur->y += 2;
}
}
if (osl_keys->held.up)
{
if (!oslCollisionMap(Map_collision,Joueur,1,0,0,0))
{
Joueur->y -= 2;
}
}
if (osl_keys->held.left)
{
if (!oslCollisionMap(Map_collision,Joueur,0,0,1,0))
{
Joueur->x -= 2;
}
}
if (osl_keys->held.right)
{
if (!oslCollisionMap(Map_collision,Joueur,0,0,0,1))
{
Joueur->x += 2;
}
}
}
/*
====================
Gestion_Map()
Initialilsation des map
====================
*/
void Gestion_Map()
{
//configuration de la map
Map01= oslCreateMap(
Map01_tileset, //Tileset
(void *)sprite_map, //Map
16,16, //Taille des tiles
30,17, //Taille de la Map
OSL_MF_U16); //Format de la Map
//configuration de la map
Map_collision= oslCreateMap(
collision_tileset, //Tileset
(void *)collisions_map, //Map
16,16, //Taille des tiles
30,17, //Taille de la Map
OSL_MF_U16); //Format de la Map
}
/*
====================
GetTile
Retourne sur quel sprite le player et possitionner
====================
*/
short GetTile(OSL_MAP *m,int col, int row)
{
u16 *map = (u16*)m->map;
return map[row*m->mapSizeX + col];
}
/*
====================
oslCollisionMap
Gestion des collisions avec les map et les perso pour le RPG
====================
*/
int oslCollisionMap(OSL_MAP *m,OSL_IMAGE *Collision,int haut,int bas, int gauche, int droit)
{
int tile;
//Test de collition pour la partie Demander suivant la touche appuyer haut, bas, gauche, droit.
if (haut)
{
tile = GetTile(m,((m->scrollX + Collision->x +Collision->stretchX ))/ m->tileX, (m->scrollY + Collision->y - 2)/ m->tileY);
if (!tile)
{
tile = GetTile(m,((m->scrollX + Collision->x))/ m->tileX, (m->scrollY + Collision->y - 2)/ m->tileY); //essaye avec la moitier du personnage pour que la tete passe quoi qu'il arrive
}
}
if (bas)
{
tile = GetTile(m,((m->scrollX + Collision->x +Collision->stretchX ))/ m->tileX, (m->scrollY + Collision->y + Collision->stretchY + 2)/ m->tileY);
if (!tile)
{
tile = GetTile(m,((m->scrollX + Collision->x))/ m->tileX, (m->scrollY + Collision->y + Collision->stretchY + 2)/ m->tileY);
}
}
if (gauche)
{
tile = GetTile(m,((m->scrollX + Collision->x - 2))/ m->tileX, (m->scrollY + Collision->y + Collision->stretchY)/ m->tileY);
if (!tile)
{
tile = GetTile(m,((m->scrollX + Collision->x - 2))/ m->tileX, (m->scrollY + Collision->y)/ m->tileY);
}
}
if (droit)
{
tile = GetTile(m,((m->scrollX + Collision->x +Collision->stretchX + 2))/ m->tileX, (m->scrollY + Collision->y + Collision->stretchY)/ m->tileY);
if (!tile)
{
tile = GetTile(m,((m->scrollX + Collision->x +Collision->stretchX + 2))/ m->tileX, (m->scrollY + Collision->y)/ m->tileY);
}
}
switch(tile)
{
case TILE_NOSOLID:
// pas de collision sur le sprite retourne donc 0
return 0;
break;
case TILE_SOLID:
// impassable retourne simplement 1 car impossable
return 1;
break;
//On peut rajouter autant de case que besoin celon ce que on recherche.
}
return 0;
}
[IMG]http://pjeffadsl.free.fr/docs2/output/tut2_screen3.png[****]
what i am haveing trouble figuring out is how he used this image to make the whole map? i dont get it, how you can use 1 image and make duplicates.
[IMG]http:/****206.imageshack.us**** 206/5092/spritesyl1.png[****]
also what do this image have anything to do with collision? like how does this work.
[IMG]http:/****518.imageshack.us**** 518/2122/collisionsskf7.png[****]
ya so im just wondering how he creates the whole map with those 2 sprites(like what part of the code and how) and what the second images has anything to do with collision.
Any ideas?Zitat:
Zitat von Xsjado7
how difficult would it be to execute the official sony music player within a homebrew using an execute function?
Well, you'd have to find what modules were required, then which partitions to load them in, then how to load them (I.E. what arguments were needed).
All in all, pretty hard, because I'm guessing you'd have to do it yourself as I don't think anyone else has done it. Still, be an interesting thing to work on.
-Aura
ok i need some help guys. I am trying to lean how to do collision detection with 2 objects on the screen but i am kinda stuck, im sure the problem is an easy one, but for a beginner i am having some trouble.
I know where the problem is but i dont know what im doing wrongCode://Oslib header file
#include <oslib/oslib.h>
//This is needed for eboot
PSP_MODULE_INFO("OSLib Sample", 0, 1, 1);
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU);
//this creates pointers for our images.
OSL_IMAGE *sprite, *sprite2, *sprite3;
//definations
#define DOWN 0
#define UP 35
#define RIGHT 70
#define LEFT 105
//variables
int sprite_position;
int sprite_march;
//declare the function like buttons and spriteAnimation
void Buttons();
void SpriteAnimate();
int collision(OSL_IMAGE *img1,float img1posX, float img1posY, OSL_IMAGE *img2, float img2posX, float img2posY,OSL_IMAGE *img3, float img3posX, float img3posY );
int main()
{
//start the Oslib library
oslInit(0);
//start the graphixs mode
oslInitGfx(OSL_PF_8888, 1);
//sets the transparency color
oslSetTransparentColor(RGB(255,0,255));
//loads the images into memory
sprite = oslLoadImageFile("sprite.png", OSL_IN_RAM, OSL_PF_5551);
sprite2 = oslLoadImageFile("sprite2.png", OSL_IN_RAM, OSL_PF_5551);
sprite3 = oslLoadImageFile("sprite3.png", OSL_IN_RAM, OSL_PF_5551);
//Disables the transparent color so it cannot be used again
oslDisableTransparentColor();
//sees if all files are avaiable
if (!sprite || !sprite2||!sprite3)
oslDebug("! one or more of the files were missing, the program cannot run");
//Sets the sprites original position, lets see if i can get 2 sprites on da bloody screen
sprite->x = 155;
sprite->y = 95;
sprite_position = DOWN;
//sets second sprite position
sprite2->x = 230;
sprite2->y = 130;
//sets thrid sprite pos
sprite3->x = 270;
sprite3->y = 130;
//main while loop
while (!osl_quit)
{
//to be able ot draw on the screen
oslStartDrawing();
//Buttons
Buttons();
//draws a green background
oslDrawGradientRect(0,0,480,272,RGB(0,128,0),RGB(0,128,0), RGB(128,255,128), RGB(128,255,128));
//this draws the images to the screen
oslDrawImage(sprite);
oslDrawImage(sprite2);
oslDrawImage(sprite3);
//stops the drawing mode
oslEndDrawing();
//sync the screen
oslSyncFrame();
}
//terminate the program
oslEndGfx();
oslQuit();
return 0;
}
void Buttons()
{
//starts up the psp buttons
oslReadKeys();
if (osl_keys->held.down)
{
if(!collision(sprite, sprite->x, sprite->y + 2, sprite2, sprite2->x, sprite2->y, sprite3, sprite3->x, sprite3->y ))
{
//sprite movement
sprite->y +=2;
//sets sprite position on sprite sheet
sprite_position = DOWN;
//calls sprie animate
SpriteAnimate();
}
}
if (osl_keys->held.up)
{
if(!collision(sprite, sprite->x, sprite->y - 2, sprite2, sprite2->x, sprite2->y,sprite3, sprite3->x, sprite3->y ))
{
sprite->y-= 2;
sprite_position = UP;
SpriteAnimate();
}
}
if (osl_keys->held.right)
{
if(!collision(sprite, sprite->x + 2, sprite->y, sprite2, sprite2->x, sprite2->y,sprite3, sprite3->x, sprite3->y ))
{
sprite->x += 2;
sprite_position = RIGHT;
SpriteAnimate();
}
}
if (osl_keys->held.left)
{
if(!collision(sprite, sprite->x - 2, sprite->y, sprite2, sprite2->x, sprite2->y,sprite3, sprite3->x, sprite3->y ))
{
sprite->x -= 2;
sprite_position = LEFT;
SpriteAnimate();
}
}
//If a button is not pressed
if (!osl_keys->held.value)
{
//Start the variable over for when a button is pressed again
sprite_march = 0;
//Sets the sprite's direction
oslSetImageTileSize(sprite,0,sprite_position,22,35);
}
}
void SpriteAnimate()
{
//Moves the sprite in the row that it is in
sprite_march++;
//Moves the sprite constantly
oslSetImageTileSize(sprite,(sprite_march * 22),sprite_position,22,35);
//resets the sprite movement in that row
if (sprite_march == 6) sprite_march = 0;
}
int collision(OSL_IMAGE *img1,float img1posX, float img1posY, OSL_IMAGE *img2, float img2posX, float img2posY, OSL_IMAGE *img3, float img3posX, float img3posY )
{
int collision;
collision = 0;
float img1width = img1->stretchX;
float img1height = img1->stretchY;
float img2width = img2->stretchX;
float img2height = img2->stretchY;
float img3width = img3->stretchX;
float img3height = img3->stretchY;
if ((img1posX + img1width > img2posX) &&
(img1posX < img2posX + img2width) &&
(img1posX + img1width > img3posX) &&
(img1posX < img2posX + img3width) &&
(img1posY + img1height > img2posY) &&
(img1posY < img2posY + img2height) )
{
collision = 1;
}
return collision;
}
Code:if ((img1posX + img1width > img2posX) &&
(img1posX < img2posX + img2width) &&
(img1posX + img1width > img3posX) &&
(img1posX < img2posX + img3width) &&
(img1posY + img1height > img2posY) &&
(img1posY < img2posY + img2height) )
{
if i put that in, none of the sprites have collision but if i take out the Bolded parts the first sprite has collision but the second one dose not.(second sprite as in the second object, not the character that is moving). How do i modify this correctly for every new object on the screen? help will be greatly appreciated.
Could someone please tell me what the hell is going on?
Spoiler for Compiler Errors:
Lines *supposedly* containing errors:
Spoiler for Lines:
Score struct:
Spoiler for Score struct:
Player struct:
Spoiler for Player struct:
You can't assign them like you are.
Use strcpy(), sprintf() or similar.
sprintf...could i get any dumber...
I thought coders are usually at their peak at 2 in the morning :p
Thanks IWN :)
it's not as easy as you think. the hardware ME decoder can be initialized byZitat:
Zitat von midnight_rush
but this is only for the initialization of the decoder. you still have to manually read the mp3 data from the file.Code:sceUtilityLoadAvModule(PSP_AV_MODULE_AVCODEC);
Hi. I started using OSLib today, and I wanted to know a way of having collision with something that is a more of an odd shape or Diagonal Boxes and not a Squarish look shape(Flat Box,Flat Platform)?