You are not logged in.
Pages: 1
I need allot of help.
I need a easy code for the turn based enemy, or bullet, shoot at any of my players.
read this information below
Information about object: enemy
Sprite: spr_enemy
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
set variable HP to 10
set variable atk to 1
set variable def to 1
set variable spd to 1
set variable pwr to random(50)
set Alarm 0 to 5
set the sprite to spr_enemy with subimage random(13) and speed 0
Alarm Event for alarm 0:
set variable pwr relative to spd
set Alarm 0 to 5
Step Event:
if HP is less than or equal to 0
destroy the instance
create a medium effect of type ellipse relative at (16,16) of color 0 below objects
else
if pwr is greater than or equal to 55
set variable pwr to 0
create instance of object bullet at relative position (0,0)
Draw Event:
Draw the instance
set the font for drawing text to font0 and align left
at relative position (0,-18) draw the value of: HP
at relative position (-18,0) draw the value of: pwr
I just need a code for those white bullets behind those enemy's on a right.
i can't just make the bullets move towerds player.x player.y, tried...
Offline
Possible solution 1:
In the Create Event of the bullet, use a Move Towards Action with x, y, speed set to player.x, player.y, 10.
However, if you want the bullets to target different instances, a script might work better.
Possible solution 2:
Create a script called "shoot_at_instance":
/// shoot_at_instance(id)
with (instance_create(x, y, bullet))
{
direction = point_direction(x, y, argument0.x, argument0.y);
}
Replace: "create instance of object bullet at relative position (0,0)"
With: "execute script shoot_at_instance with arguments (player.id,0,0,0,0)".
My computer died two weeks ago and I cannot use GameMaker: Studio right now.
Abusing forum power since 1986.
Offline
in object enemy, in event stepnormalevent action number 11 at line 13 : function "shoot_at_instance_id" expects 1 arguments, 5 provided
complete fail...
whats wrong?
Offline
That's my fault. I was giving you the answer expecting you to use the Execute Script Action. If you are calling from GML code, only use one argument, player.id.
shoot_at_instance_id(player.id);
Abusing forum power since 1986.
Offline
so whare should I put it?
i put
set variable pwr to 0
execute code:
shoot_at_instance_id(player.id);
on enemy
and with a move towreds, there still shooting a same middle guy...
Last edited by phinto (2015-05-30 13:58:39)
Offline
I don't know. Wherever you put it before.
event stepnormalevent action number 11 at line 13
Abusing forum power since 1986.
Offline
we need more users to help us...
and i did put it here
Offline
If you want more users, post a question at The GMC. That's a better place for beginners to get help. This forum is for advanced scripting problems and has very few visitors.
didn't mean to rain on your parade but...
I came from GMC... some friend asked me to go here on this site...
Offline
also I was using GM studio standard edition...
Offline
Well, I hate to rain on your parade but you need to go back to your topics and listen to what HandsomeGuy and s0lt4r telling you. You are not providing enough information to get the help you need. You need to put more effort into explaining your problem clearly with details about what you have done, what it does now, and what you want it to do instead.
This is a very basic problem. I think that's why it is hard to help you. It's not easy to know just how much help you need.
Please stop sending me email messages. I do not have time for this. There are people already trying to help you.
Abusing forum power since 1986.
Offline
Pages: 1