SpaceTraveller97

Villager
Member
Joined
Feb 5, 2021
Messages
21
Reaction score
1
First Language
Spanish
Primarily Uses
RMMV
I'm trying to make a kind of projectile engine, so i'm using images and moving them depending where the player is facing. Now what id need is check the position of the bullet image, so when it collides with some event the event will jump back. How could I do this? Id preffer to not use plugins I tried Galvs one and didnt work.
 
Last edited:

Dev_With_Coffee

Veteran
Veteran
Joined
Jul 20, 2020
Messages
965
Reaction score
470
First Language
PT-BR
Primarily Uses
RM2k3
Hello welcome!
Could you show your event controlling images?

X Screen position:
$gameScreen.picture(ID).x()

Y Screen position:
$gameScreen.picture(ID).y()

As Pictures can be are with fractional numbers, it is necessary to round with this native Javascript command:

Would be like this:
JavaScript:
parseInt($gameScreen.picture(1).x()/48)

I believe this will not work on maps larger than the screen unless the player is locked until the projectile collides or terminates the route.
 
Last edited:

SpaceTraveller97

Villager
Member
Joined
Feb 5, 2021
Messages
21
Reaction score
1
First Language
Spanish
Primarily Uses
RMMV
Hello welcome!
Could you show your event controlling images?

X Screen position:
$gameScreen.picture(ID).x()

Y Screen position:
$gameScreen.picture(ID).y()

As Pictures can be are with fractional numbers, it is necessary to round with this native Javascript command:

Would be like this:
JavaScript:
parseInt($gameScreen.picture(1).x()/48)

I believe this will not work on maps larger than the screen unless the player is locked until the projectile collides or terminates the route
I tried using that script call as conditional branch but nothing happens.
Was something like:
JavaScript:
 if $gameScreen.picture(1).x() == $gameVariables.value(5)
Adjust move route: Event jump (Variable 5 is screen X of the event)

But nothing happened
 
Last edited:

Dev_With_Coffee

Veteran
Veteran
Joined
Jul 20, 2020
Messages
965
Reaction score
470
First Language
PT-BR
Primarily Uses
RM2k3

SpaceTraveller97

Villager
Member
Joined
Feb 5, 2021
Messages
21
Reaction score
1
First Language
Spanish
Primarily Uses
RMMV
Please?


The image coordinates are by pixels and not by tiles, that's why I said that I should do the operation:


Good luck
JavaScript:
Control Variables: #001 Screen X of Player
Control Variables: #002 Screen Y of Player
Control Variables: #003 Screen X of Enemy

If: Input.isTriggered("#z")
$gameScreen.showPicture(1, "bullet", 1, $gameVariables.value(1)+40, $gameVariables.value(2) - 40, 100, 100, 255, 0);
$gameScreen.movePicture(1, 1, $gameVariables.value(1)+300, $gameVariables.value(2) - 40, 100, 100, 255, 0, 10);
Control Variables: #005 Picture Bullet X = $gameScreen.picture(1).x()
If: $gameVariables.value(5) >= $gameVariables.value(3) - 20 && $gameVariables.value(5) <= $gameVariables.value(3) + 20
Set movement Route: Enemy
                    Jump: +1, +0
Wait : 10 frames
Erase Picture: #1
Control Variables: #005 Picture Bullet X = 0
 

Dev_With_Coffee

Veteran
Veteran
Joined
Jul 20, 2020
Messages
965
Reaction score
470
First Language
PT-BR
Primarily Uses
RM2k3
Try this:
Code:
◆Control Variables: #001 Player Screen X
◆Control Variables: #002 Player Screen Y
◆Control Variables: #003 Enemy X
◆Control Variables: #004 Enemy Y

Tip:
You can use copy text on event page to paste here or use PrintScreen key instead of rewriting the post, it will save you a lot of time.

Edited:
You will need to do the operation to ensure the collision:
JavaScript:
If: ($gameVariables.value(5)/48) >= $gameVariables.value(3) && ($gameVariables.value(6)/48) <= $gameVariables.value(4)

It's no use saying this once, it has to be repeated times, because the image will move:
Code:
◆Control Variables: #005 Picture Bullet X = $gameScreen.picture(1).x()

Do this check on the enemy event and not the common event.
 
Last edited:

SpaceTraveller97

Villager
Member
Joined
Feb 5, 2021
Messages
21
Reaction score
1
First Language
Spanish
Primarily Uses
RMMV
Forget the part about dividing by 48, as I understand you didn't even try...

Try this:
Code:
◆Control Variables: #001 Player Screen X
◆Control Variables: #002 Player Screen Y
◆Control Variables: #003 Enemy Screen X

Tip:
You can use copy text on event page to paste here or use PrintScreen key instead of rewriting the post, it will save you a lot of time.
I just tried but I don't think its a problem of diving, picture is working and both are screen coords, the problem is that the bullet doesnt colliding
◆Control Variables: #002 Player Screen Y
◆Control Variables: #003 Enemy X
◆Control Variables: #004 Enemy Y[/CODE]

Tip:
You can use copy text on event page to paste here or use PrintScreen key instead of rewriting the post, it will save you a lot of time.

Edited:
You will need to do the operation to ensure the collision:
JavaScript:
If: ($gameVariables.value(5)/48) >= $gameVariables.value(3) && ($gameVariables.value(6)/48) <= $gameVariables.value(4)

It's no use saying this once, it has to be repeated times, because the image will move:
Code:
◆Control Variables: #005 Picture Bullet X = $gameScreen.picture(1).x()

Do this check on the enemy event and not the common event.
i think it need to check repeated times the coords as you say, I tried putting
◆Control Variables: #005 Picture Bullet X = $gameScreen.picture(1).x()
in the enemy but still nothing happens, maybe using loops?
 
Last edited:

Dev_With_Coffee

Veteran
Veteran
Joined
Jul 20, 2020
Messages
965
Reaction score
470
First Language
PT-BR
Primarily Uses
RM2k3
Tip, use this method:


The enemy has to be in a Parallel Process, review my post, I had already edited it.

Edited - The method is working:
There's just one problem, maps can't be bigger than the screen screen, being the default 816x624 pixels which equals 17x13 tiles:

  1. Did you understand the logic of dividing by 48?
  2. A question, why the projectile has to be by "Picture" and not a map event?
 
Last edited:

SpaceTraveller97

Villager
Member
Joined
Feb 5, 2021
Messages
21
Reaction score
1
First Language
Spanish
Primarily Uses
RMMV
Tip, use this method:


The enemy has to be in a Parallel Process, review my post, I had already edited it.

Edited - The method is working:
There's just one problem, maps can't be bigger than the screen screen, being the default 816x624 pixels which equals 17x13 tiles:

  1. Did you understand the logic of dividing by 48?
  2. A question, why the projectile has to be by "Picture" and not a map event?
Thanks Dev, it worked! had days without enter here
 

Latest Threads

Latest Posts

Latest Profile Posts

All new MZ Weather & Title updates are also RETRO'able for MV! Updated RETRO project will be released on same day I'll release updated MZ demo -project!

retro.png
Just lost about half a day's worth of work because rpg maker crashed during playtesting and corrupted my file :kaolivid:
Boku.gif
advanced_puzzling.PNG
Having a lot of fun making different poses for my character sets! Open to suggestions/critique!

CSKttqh.png

AABS laser beams features:
1,Shoot penetrating laser beams for player's normal attack
2,Beam's width/damage/comsumes/loot can be controlled by events/variables with great flexibility
3,Beam can rebound to walls or certain regionID
4,Can play SE when shooting beams
5,Beam's images can be solid images or animated ones.

Forum statistics

Threads
117,017
Messages
1,103,871
Members
152,917
Latest member
Adversary
Top