need explaination on this power-ups example

Don't know how to make something and can't find a tutorial? Ask for one here.

need explaination on this power-ups example

Postby Masky94 » Mon Apr 27, 2015 2:53 pm

someone showed me this example of power-ups using the stack function, but i still couldnt understand how it works since there is a problem on the "boxes" on the right hand side of the word "inventory", there are the boxes where the power-ups will appear when the player collected the power up, so i'd like some expert to explain to me why it tell me "invalid option to this actor" when i trying to click any of the option under "animation", and the most thing i need to know is how the stack actually works here, and it would be better if someone could tell me how to make this with steps, thank you.

i do understand the stack in the global code, but now what trouble me is the code in the "item", what does " sprintf(powerUp, clonename);" do? also how does the item will appear on the boxes when the player collected the item?

i gonna use the same concept and use it on my simple game, where a car collide with a "shield" power ups, it store in the stack, then when i use the power-up, the shield will appear around the car and protect it while moving, and i need help on how to spawn the "shield" around the car and follows it even it moves when the key is pressed.
Attachments
powerUp source.zip
(96.93 KiB) Downloaded 188 times
Masky94
 
Posts: 10
Joined: Thu Apr 16, 2015 6:13 am
Score: 0 Give a positive score

Re: need explaination on this power-ups example

Postby koala » Mon Apr 27, 2015 4:18 pm

You know what? I'll make a tutorial for this file and explain everything in details, how I've made it and all. Expect it in next 24 hours. :mrgreen:

Let's see can I quickly answer some of your questions.

Masky94 wrote:someone showed me this example of power-ups using the stack function, but i still couldnt understand how it works since there is a problem on the "boxes" on the right hand side of the word "inventory", there are the boxes where the power-ups will appear when the player collected the power up, so i'd like some expert to explain to me why it tell me "invalid option to this actor" when i trying to click any of the option under "animation",...
Those boxes are Canvas Actors. They don't have animation.

Masky94 wrote:i do understand the stack in the global code, but now what trouble me is the code in the "item", what does " sprintf(powerUp, clonename);" do?
It prints item's name into string powerUp. It is called when player collides with an item. You need to put that item on stack, to be more precise, that item's name. Name will be an argument of function push. Using sprintf() you copy item's name into powerUp, which is string, and then call push(powerUp), which puts that string, name powerUp on stack.
Here powerUp is a string, it has nothing to do with previous example in this topic where powerUp is a struct.

Masky94 wrote:also how does the item will appear on the boxes when the player collected the item?
Check function draw_from() in Script Reference. It draws actor whose name is an argument into canvas that calls this function.

Masky94 wrote:i gonna use the same concept and use it on my simple game, where a car collide with a "shield" power ups, it store in the stack, then when i use the power-up, the shield will appear around the car and protect it while moving, and i need help on how to spawn the "shield" around the car and follows it even it moves when the key is pressed.?
If you want "shiled" to follow car, then car must be parent of "shield". Right click on the "shield", Actor Control, Parent: car.

:mrgreen:
Phascolarctos cinereus
YouTube: Marko Radivojevic
Google+: Marko Radivojevic
User avatar
koala
 
Posts: 301
Joined: Thu Mar 26, 2015 7:03 pm
Location: Serbia
Score: 30 Give a positive score

Re: need explaination on this power-ups example

Postby koala » Thu Apr 30, 2015 1:44 am

Here's the tutorial - powerUp and stack-inventory Tutorial, although you've already clarified everything to yourself and I've exceeded the deadline. :roll: :mrgreen:
Phascolarctos cinereus
YouTube: Marko Radivojevic
Google+: Marko Radivojevic
User avatar
koala
 
Posts: 301
Joined: Thu Mar 26, 2015 7:03 pm
Location: Serbia
Score: 30 Give a positive score


Return to Tutorial Requests

Who is online

Users browsing this forum: No registered users and 1 guest