AccueilAccueil  FAQFAQ  RechercherRechercher  Dernières imagesDernières images  S'enregistrerS'enregistrer  Connexion  

 

 Mettre un objet hors room

Aller en bas 
4 participants
AuteurMessage
Mray
Très bonne participation



Messages : 111

Mettre un objet hors room Empty
MessageSujet: Mettre un objet hors room   Mettre un objet hors room EmptyDim 9 Oct 2011 - 23:27

J'ai un petit problème, jusqu'à maintenant, pour pas que mon personnage sorte de ma room, j'entourais celle-ci de bloc, mais à l'extérieur de celle-ci, la j'arrive plus du tout à déplacer ma room, je ne vois pas les cotés supérieur et gauche donc je ne peux plus placer mes blocs Uu
Comment régler ceci ?
Revenir en haut Aller en bas
M@d_Doc
Modérateur
M@d_Doc


Messages : 6600
Localisation : 47°44'8.04
Projet Actuel : aucun

Mettre un objet hors room Empty
MessageSujet: Re: Mettre un objet hors room   Mettre un objet hors room EmptyDim 9 Oct 2011 - 23:35

sinon, dans step :

if x<0 { x=0;}
if x>room_width {x=room_width;}
if y<0 { y=0;}
if y>room_height {y=room_height;}

et hop, plus besoin de bloc!

_________________
Mettre un objet hors room Control_commentTous les icones de gm utilisables sur le cbna ICI Mettre un objet hors room Main1_change_sprite
Revenir en haut Aller en bas
http://www.lecbna.org
Mray
Très bonne participation



Messages : 111

Mettre un objet hors room Empty
MessageSujet: Re: Mettre un objet hors room   Mettre un objet hors room EmptyDim 9 Oct 2011 - 23:47

Merci ça marche mais j'aurais quand même préféré reprendre mon ancienne méthode, enfin je m'en contenterai si je retrouve plus comment j'avais fait Smile
Revenir en haut Aller en bas
Qual
Utilisateur confirmé: Rang ****
Qual


Messages : 1450
Projet Actuel : Tower Defence

Mettre un objet hors room Empty
MessageSujet: Re: Mettre un objet hors room   Mettre un objet hors room EmptyLun 10 Oct 2011 - 12:12

bah au pire, si tu utilise une view, t'as qua mettre dans le step de tes bloc invisible x= view_xview+ce quetuveux etc


_________________
Mettre un objet hors room Icone_114
Revenir en haut Aller en bas
http://www.brainwizz.fr
Iluvyou
Nouveau
Iluvyou


Messages : 9

Mettre un objet hors room Empty
MessageSujet: Re: Mettre un objet hors room   Mettre un objet hors room EmptyJeu 13 Oct 2011 - 6:19

Je remonte légèrement ce topic désolé. (Premier post et déjà un up. o/)

M@d_Doc a écrit:
if x<0 { x=0;}
if x>room_width {x=room_width;}

Différence entre utiliser ça dans Step et faire x = xprevious dans Intersect Boundary ?
Comme j'imagine que "Intersect Boundary" c'est le même code mais avec une joulie icône. Il n'y a pas de différence (visible) ? Si ?

Merci d'avance. :)

_________________
 
~ I fought the war.. I fought the war but the war won't stop for the love of god. ♫
Revenir en haut Aller en bas
M@d_Doc
Modérateur
M@d_Doc


Messages : 6600
Localisation : 47°44'8.04
Projet Actuel : aucun

Mettre un objet hors room Empty
MessageSujet: Re: Mettre un objet hors room   Mettre un objet hors room EmptyJeu 13 Oct 2011 - 8:15

x=xprevious t'empêche de te coller contre le bord si ta vitesse est pas multiple de la distance te séparant du mur.
Avec ma méthode, ça te colle contre le bord, et tu ne bougeras pas du tout tant que tu iras vers l'exterieur.


_________________
Mettre un objet hors room Control_commentTous les icones de gm utilisables sur le cbna ICI Mettre un objet hors room Main1_change_sprite
Revenir en haut Aller en bas
http://www.lecbna.org
Iluvyou
Nouveau
Iluvyou


Messages : 9

Mettre un objet hors room Empty
MessageSujet: Re: Mettre un objet hors room   Mettre un objet hors room EmptyJeu 13 Oct 2011 - 14:48

Ah ok. Merci. (C'est mieux ta méthode enfaite)

Petit truc par-contre : if x>room_width {x=room_width;}
Ne marchera pas (Enfin si mais bizarrement) si l'origine du sprite est à x 0 parce la condition veut que ça s'exécute quand l'objet est hors de la room. :)

_________________
 
~ I fought the war.. I fought the war but the war won't stop for the love of god. ♫
Revenir en haut Aller en bas
M@d_Doc
Modérateur
M@d_Doc


Messages : 6600
Localisation : 47°44'8.04
Projet Actuel : aucun

Mettre un objet hors room Empty
MessageSujet: Re: Mettre un objet hors room   Mettre un objet hors room EmptyJeu 13 Oct 2011 - 14:58

ben alors tu fais if (x+sprite_get_width(sprite_index)-sprite_get_xoffset(sprite_index) >room_width)

Faut un peux réfléchir Smile

_________________
Mettre un objet hors room Control_commentTous les icones de gm utilisables sur le cbna ICI Mettre un objet hors room Main1_change_sprite
Revenir en haut Aller en bas
http://www.lecbna.org
Contenu sponsorisé





Mettre un objet hors room Empty
MessageSujet: Re: Mettre un objet hors room   Mettre un objet hors room Empty

Revenir en haut Aller en bas
 
Mettre un objet hors room
Revenir en haut 
Page 1 sur 1

Permission de ce forum:Vous ne pouvez pas répondre aux sujets dans ce forum
Forum Le CBNA :: Développement :: Entraide débutants-
Sauter vers: